Re: [PATCH] staging:iio:ad7291: add missing .driver_module to struct iio_info

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

 



On 07/05/2013 05:55 PM, Lars-Peter Clausen wrote:
> On 07/04/2013 06:01 PM, Greg KH wrote:
>> On Thu, Jul 04, 2013 at 09:46:34PM +0800, Wei Yongjun wrote:
>> That's a hint that the register function should be changed so that no module ever has to set this value. Look at how PCI and USB do their driver registration function for how to do this properly. 
> I don't think that the same approach as used for PCI, USB and others works
> as nicely here. For one we do not have a registration function for the info
> struct, it would probably be possible to rework things a bit, but not
> without some code churn. And secondly we'd also have to make all the
> iio_info structs non-const, which is something I don't like. And thirdly we
> do have the proper tools to auto-detect such missing initializations (e.g.
> using coccinelle), so we can catch these errors early on and they won't show
> up in new drivers.

Agree, with the follow coccinelle script, we can found this easily.

@r__iio_info@
identifier nm;
position p;
@@
struct iio_info nm@p = {
...,
  .driver_module = THIS_MODULE,
...
};

@@
identifier nm;
position p != {r__iio_info.p};
@@
struct iio_info nm@p = {
...,
+ .driver_module = THIS_MODULE,
};





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




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux