lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 04 Jul 2011 10:45:03 +0300
From:	Igor Grinberg <grinberg@...pulab.co.il>
To:	Grant Likely <grant.likely@...retlab.ca>
CC:	Christian Gmeiner <christian.gmeiner@...il.com>,
	linux-kernel@...r.kernel.org
Subject: Re: pca953x: support working w/o platform data

On 07/04/11 09:43, Grant Likely wrote:

> On Fri, Jul 01, 2011 at 08:17:44PM +0300, Igor Grinberg wrote:
>> On 07/01/11 14:33, Christian Gmeiner wrote:
>>
>>> Provide defaults for pca953x, so the driver can be used w/o
>>> providing platform data.
>> Wouldn't it be better to provide a default pdata structure inside the driver
>> and use it in case no pdata supplied, so you will not have to patch the
>> driver all around checking each time if pdata is valid?
>
> I would agree.  However, you will need to adjust the structure of the
> driver somewhat to do so.  Once a device is registered, the data
> pointed to by platform_device->dev.platform_data must be treated as
> immutable by the driver, otherwise driver unbind/rebind can become
> horribly broken.

The driver already copies several field from pdata to the chip structure.
Also, chip->dyn_pdata can be used for this purpose, but instead of
allocating it dynamically, it just can be  a part of the chip structure.

> I often solve this by keeping a full copy of the pdata structure in
> the driver's private data structure, and always referencing the 'safe'
> local copy instead of dereferencing dev->platform_data every time.

If this is done and the chip structure will contain all the information
needed (either flat, or in some kind of dyn_pdata), then indeed there
will be no need to access the pdata anymore.
Also, there will be no need to allocate pdata in pca953x_get_alt_pdata()
function.
I think this would be the most clean and safe way.

-- 
Regards,
Igor.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ