[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51E466A3.4010503@schinagl.nl>
Date: Mon, 15 Jul 2013 23:16:19 +0200
From: Oliver Schinagl <oliver+list@...inagl.nl>
To: linux-sunxi@...glegroups.com
CC: Greg KH <gregkh@...uxfoundation.org>,
Maxime Ripard <maxime.ripard@...e-electrons.com>,
arnd@...db.de, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, andy.shevchenko@...il.com,
linux@....linux.org.uk, linus.walleij@...aro.org,
Oliver Schinagl <oliver@...inagl.nl>
Subject: Re: [linux-sunxi] Re: [PATCH 1/2] Initial support for Allwinner's
Security ID fuses
On 07/06/13 21:36, Greg KH wrote:
> On Fri, Jul 05, 2013 at 09:24:47AM +0200, Oliver Schinagl wrote:
>> The other 'broken' drivers that where linked earlier, also use the
>> BINARY attributes.
>>
>> So Greg, if you could be so kind and give me an example how to
>> implement this properly, I am at loss and don't know :(
>
> Ah crap, devices don't have a binary attribute group, like struct class
> does. I'll go add that on Monday and send you the patch to see if that
> helps you out. I'll also go through and fix up all of the binary
> attribute drivers to keep them from doing that...
>
> Sorry, I missed that earlier, but thanks for trying and pointing out my
> mistake.
>
> greg k-h
>
Greg,
I know you are a busy man and I hate take away some of your time, but
could you be so kind and point me into the right direction and show me
what I should do?
With your latest patches for binary attributes and your blog post, I
thought that you want to create your binary attributes before the probe
function, to avoid the userspace race. To do that, we have two options,
create them in init (ugly?) or fill the .group member if available so it
gets automatically created from the register function.
Well in my case, I'm using the module_platform_driver() macro which
expects the struct platform_driver. Platform_driver has a device_driver
member .driver where the .groups is located. Great, using that works and
we should have the sysfs entry race-free. However I don't know hot to
exchange data between that and the rest of my driver.
Before I used to_platform_device(kobj_to_dev(kobj)) as passed via the
.read function to obtain a platform_device where i could use
platform_get_drvdata on. All was good, but that doesn't fly now and my
knowledge is a bit short as to why.
The second method is finding some other shared structure given that we
get a platform_device in the probe function, yet I couldn't find
anything and this platform_device isn't the same as the one from the .read.
Of course using a global var bypasses this issue, but I'm sure it won't
pass review ;)
So using these new patches for binary attributes, how can I pass data
between my driver and the sysfs files using a platform_driver? Or are
other 'hacks' needed and using the .groups attribute from
platform_driver->device_driver->groups is really the wrong approach.
I did ask around and still haven't figured it out so far, so I do
apologize if you feel I'm wasting your precious time.
Oliver
View attachment "sunxi_sid.c" of type "text/x-csrc" (4120 bytes)
Powered by blists - more mailing lists