[rt2x00-users] [RFC/RFT 1/8] rt2x00: Introduce concept of driver data in struct rt2x00_dev.

Gertjan van Wingerde gwingerde at gmail.com
Tue Jan 31 10:03:36 AEDT 2012


Hi Stanislaw,

On 01/30/12 12:41, Stanislaw Gruszka wrote:
> On Sun, Jan 29, 2012 at 05:59:30PM +0100, Gertjan van Wingerde wrote:
>>  struct rt2x00_ops {
>>  	const char *name;
>> +	const unsigned int drv_data_size;
> [snip]
>> +	if (rt2x00dev->ops->drv_data_size > 0) {
>> +		rt2x00dev->drv_data = kzalloc(rt2x00dev->ops->drv_data_size,
>> +			                      GFP_KERNEL);
>> +		if (!rt2x00dev->drv_data) {
>> +			retval = -ENOMEM;
>> +			goto exit;
>> +		}
>> +	}
> I think this should be done by low level driver, we just keep pointer,
> and low level driver use it how it wants.
> 

I considered that, but couldn't find a good spot to put this in the low
level driver code. Also, the current implementation can be considered to
be a service of the generic layer towards the low level drivers, only
executed if the low level driver indicates it needs it (via setting the
drv_data_size item to a value bigger than 0).
This is not too different as the eeprom allocation, the firmware
loading, etc., which are also implemented as generic layer services
towards the low level drivers.

---
Gertjan




More information about the users mailing list