lkml.org 
[lkml]   [2013]   [Jan]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 2/3] tegra: pwm-backlight: add tegra pwm-bl driver
Date
On Wednesday 23 January 2013 18:15:30 Leela Krishna Amudala wrote:
> > + pwm_backlight_set_subdriver_data(dev, data);
>
> Here you are passing ventana_bl_data pointer as input and in the
> pwm_backlight_get_subdriver_data() function you are assigning the
> received driver data to backlight_device pointer. As both are two
> different structures with different structure fields in it. There can
> be a chance for a crash.

That's because the following happens later in pwm_backlight_probe():

pb->subdriver_data = dev_get_drvdata(&pdev->dev);
...
bl = backlight_device_register(dev_name(&pdev->dev), &pdev->dev, pb,
&pwm_backlight_ops, &props);
...
platform_set_drvdata(pdev, bl);

So from then on the result of dev_get_drvdata() is indeed an instance of
backlight_device from which we can retrieve the subdriver data. I'm not really
proud of this. But fortunately it seems like we are going to do things
differently.

Alex.



\
 
 \ /
  Last update: 2013-01-23 12:02    [W:0.171 / U:0.352 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site