[RFC 1/2] export pcmcia info to hotplug

Greg KH greg at kroah.com
Thu Feb 10 20:03:41 EST 2005


On Thu, Feb 10, 2005 at 09:25:39PM +0100, Dominik Brodowski wrote:
> Export information to /sbin/hotplug for PCMCIA devices:
> card_id, manf_id, func_id, bus_id (like pcmcia1.0) and
> crc32-hashes of the prod_id strings. 
> Why not the prod_id strings themselves?
> a) They may contain all sorts of strange and difficult to handle characters, 
>    like " ".
> b) It's impossible to pass multiple strings to userspace.
> 
> Signed-off-by: Dominik Brodowski <linux at dominikbrodowski.net>

Idea looks sane, but your code has a bunch of tab vs. spaces issues.

> +        /* stuff we want to pass to /sbin/hotplug */
> +        envp[i++] = scratch;
> +        length += scnprintf (scratch, buffer_size - length,
> +			     "PCMCIA_DEVICE=%01X",
> +			     p_dev->device_no);
> +        if ((buffer_size - length <= 0) || (i >= num_envp))
> +                return -ENOMEM;
> +        ++length;
> +        scratch += length;

There is a helper macro/function to handle this kind of logic for you.
I'd recommend using it.

thanks,

greg k-h



More information about the linux-pcmcia mailing list