diff mbox

[RFC/PATCH,10/14] dt: Add pd_size to AUXDATA structure

Message ID 1312897232-4792-11-git-send-email-manjugk@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

manjugk manjugk Aug. 9, 2011, 2:10 p.m. UTC
Add pd_size in the AUXDATA structure so that device drivers which require
platform_data size can pass along with AUXDATA.

Signed-off-by: G, Manjunath Kondaiah <manjugk@ti.com>
---
 drivers/of/platform.c       |    2 ++
 include/linux/of_platform.h |    5 +++++
 2 files changed, 7 insertions(+), 0 deletions(-)

Comments

Benoit Cousson Aug. 10, 2011, 11:57 a.m. UTC | #1
On 8/9/2011 4:10 PM, G, Manjunath Kondaiah wrote:
>
> Add pd_size in the AUXDATA structure so that device drivers which require
> platform_data size can pass along with AUXDATA.

It is really needed by device driver? Or is it because omap_device_build 
is using platform_device_add_data that is doing a copy of the pdata and 
thus require the size?

> Signed-off-by: G, Manjunath Kondaiah<manjugk@ti.com>
> ---
>   drivers/of/platform.c       |    2 ++
>   include/linux/of_platform.h |    5 +++++
>   2 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
> index ebbbf42..4b27286 100644
> --- a/drivers/of/platform.c
> +++ b/drivers/of/platform.c
> @@ -565,6 +565,7 @@ static int of_platform_bus_create(struct device_node *bus,
>   	struct platform_device *dev;
>   	const char *bus_id = NULL;
>   	void *platform_data = NULL;
> +	int pd_size;

Maybe platform_data_size will be a little bit more consistent?

Regards,
Benoit

>   	int id = -1;
>   	int rc = 0;
>
> @@ -588,6 +589,7 @@ static int of_platform_bus_create(struct device_node *bus,
>   		bus_id = auxdata->name;
>   		id = auxdata->id;
>   		platform_data = auxdata->platform_data;
> +		pd_size = auxdata->pd_size;
>   	}
>
>   	if (of_device_is_compatible(bus, "arm,primecell")) {
> diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
> index 252246c..a3be980 100644
> --- a/include/linux/of_platform.h
> +++ b/include/linux/of_platform.h
> @@ -47,6 +47,7 @@ struct of_dev_auxdata {
>   	char *name;
>   	int id;
>   	void *platform_data;
> +	int pd_size;
>   };
>
>   /* Macro to simplify populating a lookup table */
> @@ -58,6 +59,10 @@ struct of_dev_auxdata {
>   	{ .compatible = _compat, .phys_addr = _phys, .name = _name, \
>   	  .id = _id, .platform_data = _pdata }
>
> +#define OF_DEV_AUXDATA_ID_PDSIZE(_compat,_phys,_name,_id,_pdata,_pd_size) \
> +	{ .compatible = _compat, .phys_addr = _phys, .name = _name, \
> +	  .id = _id, .platform_data = _pdata, .pd_size = _pd_size }
> +
>   /**
>    * of_platform_driver - Legacy of-aware driver for platform devices.
>    *

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Grant Likely Aug. 10, 2011, 1:16 p.m. UTC | #2
On Wed, Aug 10, 2011 at 5:57 AM, Cousson, Benoit <b-cousson@ti.com> wrote:
> On 8/9/2011 4:10 PM, G, Manjunath Kondaiah wrote:
>>
>> Add pd_size in the AUXDATA structure so that device drivers which require
>> platform_data size can pass along with AUXDATA.
>
> It is really needed by device driver? Or is it because omap_device_build is
> using platform_device_add_data that is doing a copy of the pdata and thus
> require the size?

Yes, I have the same question.  What is the reason for needing the
platform data size?

g.

>
>> Signed-off-by: G, Manjunath Kondaiah<manjugk@ti.com>
>> ---
>>  drivers/of/platform.c       |    2 ++
>>  include/linux/of_platform.h |    5 +++++
>>  2 files changed, 7 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
>> index ebbbf42..4b27286 100644
>> --- a/drivers/of/platform.c
>> +++ b/drivers/of/platform.c
>> @@ -565,6 +565,7 @@ static int of_platform_bus_create(struct device_node
>> *bus,
>>        struct platform_device *dev;
>>        const char *bus_id = NULL;
>>        void *platform_data = NULL;
>> +       int pd_size;
>
> Maybe platform_data_size will be a little bit more consistent?
>
> Regards,
> Benoit
>
>>        int id = -1;
>>        int rc = 0;
>>
>> @@ -588,6 +589,7 @@ static int of_platform_bus_create(struct device_node
>> *bus,
>>                bus_id = auxdata->name;
>>                id = auxdata->id;
>>                platform_data = auxdata->platform_data;
>> +               pd_size = auxdata->pd_size;
>>        }
>>
>>        if (of_device_is_compatible(bus, "arm,primecell")) {
>> diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
>> index 252246c..a3be980 100644
>> --- a/include/linux/of_platform.h
>> +++ b/include/linux/of_platform.h
>> @@ -47,6 +47,7 @@ struct of_dev_auxdata {
>>        char *name;
>>        int id;
>>        void *platform_data;
>> +       int pd_size;
>>  };
>>
>>  /* Macro to simplify populating a lookup table */
>> @@ -58,6 +59,10 @@ struct of_dev_auxdata {
>>        { .compatible = _compat, .phys_addr = _phys, .name = _name, \
>>          .id = _id, .platform_data = _pdata }
>>
>> +#define OF_DEV_AUXDATA_ID_PDSIZE(_compat,_phys,_name,_id,_pdata,_pd_size)
>> \
>> +       { .compatible = _compat, .phys_addr = _phys, .name = _name, \
>> +         .id = _id, .platform_data = _pdata, .pd_size = _pd_size }
>> +
>>  /**
>>   * of_platform_driver - Legacy of-aware driver for platform devices.
>>   *
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
manjugk manjugk Aug. 10, 2011, 4:02 p.m. UTC | #3
On Wed, Aug 10, 2011 at 07:16:30AM -0600, Grant Likely wrote:
> On Wed, Aug 10, 2011 at 5:57 AM, Cousson, Benoit <b-cousson@ti.com> wrote:
> > On 8/9/2011 4:10 PM, G, Manjunath Kondaiah wrote:
> >>
> >> Add pd_size in the AUXDATA structure so that device drivers which require
> >> platform_data size can pass along with AUXDATA.
> >
> > It is really needed by device driver? Or is it because omap_device_build is
> > using platform_device_add_data that is doing a copy of the pdata and thus
> > require the size?
> 
> Yes, I have the same question.  What is the reason for needing the
> platform data size?

Yes. It is required by "omap_device_build" which in turn calls 
"platform_device_add_data" and copies using "kmemdup" and original
pdata pointer memory will get freed.

It is required by hwmod and not device driver. I can change description.

> 
> g.
> 
> >
> >> Signed-off-by: G, Manjunath Kondaiah<manjugk@ti.com>
> >> ---
> >>  drivers/of/platform.c       |    2 ++
> >>  include/linux/of_platform.h |    5 +++++
> >>  2 files changed, 7 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
> >> index ebbbf42..4b27286 100644
> >> --- a/drivers/of/platform.c
> >> +++ b/drivers/of/platform.c
> >> @@ -565,6 +565,7 @@ static int of_platform_bus_create(struct device_node
> >> *bus,
> >>        struct platform_device *dev;
> >>        const char *bus_id = NULL;
> >>        void *platform_data = NULL;
> >> +       int pd_size;
> >
> > Maybe platform_data_size will be a little bit more consistent?

Thought shorter name is better and still it should be readable.

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

Patch

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index ebbbf42..4b27286 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -565,6 +565,7 @@  static int of_platform_bus_create(struct device_node *bus,
 	struct platform_device *dev;
 	const char *bus_id = NULL;
 	void *platform_data = NULL;
+	int pd_size;
 	int id = -1;
 	int rc = 0;
 
@@ -588,6 +589,7 @@  static int of_platform_bus_create(struct device_node *bus,
 		bus_id = auxdata->name;
 		id = auxdata->id;
 		platform_data = auxdata->platform_data;
+		pd_size = auxdata->pd_size;
 	}
 
 	if (of_device_is_compatible(bus, "arm,primecell")) {
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 252246c..a3be980 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -47,6 +47,7 @@  struct of_dev_auxdata {
 	char *name;
 	int id;
 	void *platform_data;
+	int pd_size;
 };
 
 /* Macro to simplify populating a lookup table */
@@ -58,6 +59,10 @@  struct of_dev_auxdata {
 	{ .compatible = _compat, .phys_addr = _phys, .name = _name, \
 	  .id = _id, .platform_data = _pdata }
 
+#define OF_DEV_AUXDATA_ID_PDSIZE(_compat,_phys,_name,_id,_pdata,_pd_size) \
+	{ .compatible = _compat, .phys_addr = _phys, .name = _name, \
+	  .id = _id, .platform_data = _pdata, .pd_size = _pd_size }
+
 /**
  * of_platform_driver - Legacy of-aware driver for platform devices.
  *