Re: [PATCH 1/6] gpio: make the gpiochip a real device

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

 



On Mon, Nov 02, 2015 at 12:47:37PM +0000, Mark Brown wrote:
> On Mon, Nov 02, 2015 at 01:43:23PM +0100, Johan Hovold wrote:
> > On Mon, Nov 02, 2015 at 12:25:14PM +0000, Mark Brown wrote:
> 
> > > > First of all, you must never register the same device structure twice.
> 
> > > Well, you can unregister and reregister (and it is reasonable practice
> > > to make sure that the struct isn't full of noise) - we usually allocate
> > > things out of kzalloc().
> 
> > Actually, no. It's an explicitly forbidden practise to reregister the
> > same struct device.
> 
> A memset() should be enough, if not then we have problems with any
> dynamically allocated struct device.

And how would you know that it is safe to memset that struct device?
There can still be references to it. And driver core explicitly forbids
this (see device_add() for example).

Dynamically allocated struct device are not the problem as then you're
not *reusing* the same device structure.

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



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux