Search Linux Wireless

Re: [PATCH 2/2] compat-wireless: fix use of device_create

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

 



On Mon, 2010-04-05 at 23:03 +0200, Hauke Mehrtens wrote: 
> The signature of device_create changed in the last kernel version.
> Backporting it in compat is hard because of the use of var args.

I see it's applied already, but I hope some belated critique could be
useful anyway.

The log mentions "last kernel version", but the patch affects Linux
2.6.26 and older.  Either the log is wrong (more likely), or the
implementation doesn't include something that it was meant to do.

> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
> + 		data->dev = device_create(hwsim_class, NULL, 0, hw,
> + 					  "hwsim%d", i);
> ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26))
> ++		data->dev = device_create_drvdata(hwsim_class, NULL, 0, hw,
> ++					  "hwsim%d", i);
> ++#else
> ++		data->dev = device_create(hwsim_class, NULL, 0,
> ++					  "hwsim%d", i);
> ++		dev_set_drvdata(data->dev, hw);
> ++#endif

Linux 2.6.26 should be able to use exactly the same code as the older
kernels.  It has device_create() with the old signature and
dev_set_drvdata().  I'd rather avoid extra complexity.

Also, it should be possible to redefine device_create() for older
kernels using a macro:

#define device_create(cls, parent, devt, drvdata, fmt, ...)            \
({                                                                     \
       struct device *_dev;                                            \
       _dev = (device_create)(cls, parent, devt, fmt, __VA_ARGS__);    \
       dev_set_drvdata(_dev, drvdata);                                 \
       _dev;                                                           \
})

-- 
Regards,
Pavel Roskin
--
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