Search Linux Wireless

Re: [PATCH v2 03/20] mmc: support embedded data field in mmc_host

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 6 Aug 2010, Russell King - ARM Linux wrote:

> On Fri, Aug 06, 2010 at 01:02:24PM +0300, Ohad Ben-Cohen wrote:
> > We have Russell's suggestion which is nice and simple, but it has the
> > 1 device limitation.
> 
> You could make it generic by doing something like this:
> 
> #define set_device_data(name, type, index, data)			\
>  ({									\
>     extern void __set_device_data(const char *, int, void *, size_t);	\
>     BUILD_BUG_ON(!__same_type(type, *data));				\
>     __set_device_data(name ":" #type, index, data, sizeof(type));	\
>  })
> 
> #define get_device_data(name, type, index) ({				\
>   extern void *__get_device_data(const char *, int);			\
>   type *__ptr = __get_device_data(name ":" #type, index);		\
>   __ptr; })
> 
> And now we have something that takes a string and index to use as a lookup
> key in some kind of list - and it's typesafe (because the lookup key is
> dependent on the stringified type.)
> 
> But... at this point I feel that we're getting too complicated, and will
> get shouted at to use something like DT which already solves this problem.

DT is not generally available yet.  A simple interim solution would 
still be worth it.


Nicolas
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux