From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Lamparter Subject: Re: [PATCH v7 2/3] gpio: mmio: add DT support for memory-mapped GPIOs Date: Fri, 06 May 2016 14:22:23 +0200 Message-ID: <2264861.CW2OZaRj2L@debian64> References: <50f7f506364f84effd5224677b21726fd2e511a4.1462372360.git.chunkeey@googlemail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Return-path: In-Reply-To: Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Andy Shevchenko Cc: "linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , devicetree , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , linux-arm Mailing List , =?ISO-8859-1?Q?=C1lvaro_Fern=E1ndez?= Rojas , Kumar Gala , Alexander Shiyan , Ian Campbell , Mark Rutland , Pawel Moll , Rob Herring , Alexandre Courbot , Linus Walleij List-Id: devicetree@vger.kernel.org On Friday, May 06, 2016 02:44:14 PM Andy Shevchenko wrote: > > + /* If ngpio property is not specified, of_property_read_u32 > > + * will return -EINVAL. In this case the number of GPIOs is > > + * automatically determined by the register width. Any > > + * other error of of_property_read_u32 is due bad data and > > + * needs to be dealt with. > > Couple style issues: > /* > * First sentence starts here. func() are going with parens. > */ Ack, I'm used to drivers/net. I have to remove the ngpio in a future version, so the comment is removed as well. > > + > > +static struct bgpio_pdata *bgpio_parse_dt(struct platform_device *pdev, > > + unsigned long *flags) > > +{ > > + const int (*parse_dt)(struct platform_device *, > > + struct bgpio_pdata *, unsigned long *); > > + const struct device_node *node = pdev->dev.of_node; > > + const struct of_device_id *of_id; > > + struct bgpio_pdata *pdata; > > + int err = -ENODEV; > > (1) > > > + > > + of_id = of_match_node(bgpio_of_match, node); > > + if (!of_id) > > + return NULL; > > (2) > > Why so? This is because of existing arch code in /arch/arm/mach-clps711x/board-p720t.c. You remember there's a driver with a device-tree binding "cirrus,clps711x-gpio" for it. But the current kernel arch code still registers a platform_device and it doesn't look like it has any device tree support. So this is necessary for those partially converted archs to co-exist with the driver. I'll update the -ENODEV to -EINVAL. > > + > > + pdata = devm_kzalloc(&pdev->dev, sizeof(struct bgpio_pdata), > > + GFP_KERNEL); > > + if (!pdata) > > + return ERR_PTR(-ENOMEM); > > + > > + parse_dt = (const void *)of_id->data; > > + if (parse_dt) > > + err = parse_dt(pdev, pdata, flags); > > + if (err) > > + return ERR_PTR(err); > > + > > + return pdata; > > +} > > +#else > > +static struct bgpio_pdata *bgpio_parse_dt(struct platform_device *pdev, > > + unsigned long *flags) > > +{ > > + return NULL; > > +} > > +#endif /* CONFIG_OF */ -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html