mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* RFC: of_device_id: use pointer for the data field
@ 2015-04-26 14:38 Antony Pavlov
  2015-04-27  6:00 ` Sascha Hauer
  0 siblings, 1 reply; 3+ messages in thread
From: Antony Pavlov @ 2015-04-26 14:38 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Hi!

Just now barebox' of_device_id struct uses unsigned long type for data field:

  struct of_device_id {
          char *compatible;
          unsigned long data;
  };

Here is of_device_id struct in linux kernel:

  struct of_device_id {
          char name[32];
          char type[32];
          char compatible[128];
          const void *data;
  };

Just all data fields are used as pointers and need 'unsigned long' casting.
E.g. see 'git grep -A 4 of_device_id drivers/' output:

  drivers/ata/sata-imx.c:static __maybe_unused struct of_device_id imx_sata_dt_ids[] = {
  drivers/ata/sata-imx.c- {
  drivers/ata/sata-imx.c-         .compatible = "fsl,imx6q-ahci",
  drivers/ata/sata-imx.c-         .data = (unsigned long)&data_imx6,
  drivers/ata/sata-imx.c- }, {

Could we use 'const void *' type for data field as linux kernel does?

-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: RFC: of_device_id: use pointer for the data field
  2015-04-26 14:38 RFC: of_device_id: use pointer for the data field Antony Pavlov
@ 2015-04-27  6:00 ` Sascha Hauer
  2015-04-27  9:17   ` Antony Pavlov
  0 siblings, 1 reply; 3+ messages in thread
From: Sascha Hauer @ 2015-04-27  6:00 UTC (permalink / raw)
  To: Antony Pavlov; +Cc: barebox

On Sun, Apr 26, 2015 at 05:38:31PM +0300, Antony Pavlov wrote:
> Hi!
> 
> Just now barebox' of_device_id struct uses unsigned long type for data field:
> 
>   struct of_device_id {
>           char *compatible;
>           unsigned long data;
>   };
> 
> Here is of_device_id struct in linux kernel:
> 
>   struct of_device_id {
>           char name[32];
>           char type[32];
>           char compatible[128];
>           const void *data;
>   };
> 
> Just all data fields are used as pointers and need 'unsigned long' casting.
> E.g. see 'git grep -A 4 of_device_id drivers/' output:
> 
>   drivers/ata/sata-imx.c:static __maybe_unused struct of_device_id imx_sata_dt_ids[] = {
>   drivers/ata/sata-imx.c- {
>   drivers/ata/sata-imx.c-         .compatible = "fsl,imx6q-ahci",
>   drivers/ata/sata-imx.c-         .data = (unsigned long)&data_imx6,
>   drivers/ata/sata-imx.c- }, {
> 
> Could we use 'const void *' type for data field as linux kernel does?

Yes, good idea.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: RFC: of_device_id: use pointer for the data field
  2015-04-27  6:00 ` Sascha Hauer
@ 2015-04-27  9:17   ` Antony Pavlov
  0 siblings, 0 replies; 3+ messages in thread
From: Antony Pavlov @ 2015-04-27  9:17 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On Mon, 27 Apr 2015 08:00:59 +0200
Sascha Hauer <s.hauer@pengutronix.de> wrote:

> On Sun, Apr 26, 2015 at 05:38:31PM +0300, Antony Pavlov wrote:
> > Hi!
> > 
> > Just now barebox' of_device_id struct uses unsigned long type for data field:
> > 
> >   struct of_device_id {
> >           char *compatible;
> >           unsigned long data;
> >   };
> > 
> > Here is of_device_id struct in linux kernel:
> > 
> >   struct of_device_id {
> >           char name[32];
> >           char type[32];
> >           char compatible[128];
> >           const void *data;
> >   };
> > 
> > Just all data fields are used as pointers and need 'unsigned long' casting.
> > E.g. see 'git grep -A 4 of_device_id drivers/' output:
> > 
> >   drivers/ata/sata-imx.c:static __maybe_unused struct of_device_id imx_sata_dt_ids[] = {
> >   drivers/ata/sata-imx.c- {
> >   drivers/ata/sata-imx.c-         .compatible = "fsl,imx6q-ahci",
> >   drivers/ata/sata-imx.c-         .data = (unsigned long)&data_imx6,
> >   drivers/ata/sata-imx.c- }, {
> > 
> > Could we use 'const void *' type for data field as linux kernel does?
> 
> Yes, good idea.

Ok, I'll try to prepare the patch in several days.

-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-04-27  9:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-26 14:38 RFC: of_device_id: use pointer for the data field Antony Pavlov
2015-04-27  6:00 ` Sascha Hauer
2015-04-27  9:17   ` Antony Pavlov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox