From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965695AbcJ1Qzy (ORCPT ); Fri, 28 Oct 2016 12:55:54 -0400 Received: from muru.com ([72.249.23.125]:46367 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934937AbcJ1Qzv (ORCPT ); Fri, 28 Oct 2016 12:55:51 -0400 Date: Fri, 28 Oct 2016 09:55:47 -0700 From: Tony Lindgren To: Linus Walleij Cc: Jon Hunter , Mark Rutland , Rob Herring , Grygorii Strashko , Nishanth Menon , linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org Subject: Re: [PATCH 2/4] pinctrl: single: Use generic parser and #pinctrl-cells for pinctrl-single,pins Message-ID: <20161028165547.7pigv2bh6eydtg5m@atomide.com> References: <20161025164538.453-1-tony@atomide.com> <20161025164538.453-3-tony@atomide.com> <20161026141628.x42rbn5o2ekdoluk@atomide.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161026141628.x42rbn5o2ekdoluk@atomide.com> User-Agent: Mutt/1.6.2-neo (2016-07-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Tony Lindgren [161026 07:17]: > * Tony Lindgren [161025 09:51]: > > We can now use generic parser. To support the legacy binding without > > #pinctrl-cells, add pcs_quirk_missing_pinctrl_cells() and warn about > > missing #pinctrl-cells. > ... > > > +/** > > + * pcs_quirk_missing_pinctrl_cells - handle legacy binding > > + * @pcs: pinctrl driver instance > > + * @np: device tree node > > + * @cells: number of cells > > + * > > + * Handle legacy binding with no #pinctrl-cells. This should be > > + * always two pinctrl-single,bit-per-mux and one for others. > > + * At some point we may want to consider removing this. > > + */ > > +static int pcs_quirk_missing_pinctrl_cells(struct pcs_device *pcs, > > + struct device_node *np, > > + int cells) > > +{ > > + struct property *p; > > + const char *name = "#pinctrl-cells"; > > + int error; > > + u32 val; > > + > > + error = of_property_read_u32(np, name, &val); > > + if (!error) > > + return 0; > > + > > + dev_warn(pcs->dev, "please update dts to use %s = <%i>\n", > > + name, cells); > > + > > + p = devm_kzalloc(pcs->dev, sizeof(*p), GFP_KERNEL); > > + if (!p) > > + return -ENOMEM; > > + > > + p->length = sizeof(__be32); > > + p->value = devm_kzalloc(pcs->dev, sizeof(__be32), GFP_KERNEL); > > + if (!p->value) > > + return -ENOMEM; > > + *(__be32 *)p->value = cpu_to_be32(cells); > > + > > + p->name = devm_kstrdup(pcs->dev, name, GFP_KERNEL); > > + if (!p->name) > > + return -ENOMEM; > > + > > + pcs->missing_nr_pinctrl_cells = p; > > + > > + return of_add_property(np, pcs->missing_nr_pinctrl_cells); > > +} > > Looking at some make randconfig results, looks like we don't have > of_add_property() and of_remove_property() exported. Is there some > reason not to export them? I'll only do of_add_property() and of_remove_property() if we have IS_BUILTIN(CONFIG_PINCTRL_SINGLE). I bet I'm the only one using it as a loadable module right now :) Then we can remove those if we decide to export of_add_property() and of_remove_property(). Regards, Tony