From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Warren Date: Thu, 12 May 2016 11:50:23 -0600 Subject: [U-Boot] [PATCH V2 2/2] sunxi: gpio: convert bind() to use driver data In-Reply-To: References: <1463001985-4039-1-git-send-email-swarren@wwwdotorg.org> <1463001985-4039-2-git-send-email-swarren@wwwdotorg.org> Message-ID: <5734C25F.3040307@wwwdotorg.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 05/12/2016 11:43 AM, Simon Glass wrote: > Hi Stephen, > > On 11 May 2016 at 15:26, Stephen Warren wrote: >> From: Stephen Warren >> >> Now that the DM core sets driver_data before calling bind(), this driver >> can make use of driver_data to determine the set of child devices to >> create, rather than manually re-implementing the matching logic in code. >> diff --git a/drivers/gpio/sunxi_gpio.c b/drivers/gpio/sunxi_gpio.c >> +#define ID(_compat_, _soc_data_) \ >> + { .compatible = _compat_, .data = (ulong)&soc_data_##_soc_data_ } >> + >> static const struct udevice_id sunxi_gpio_ids[] = { >> - { .compatible = "allwinner,sun4i-a10-pinctrl" }, >> - { .compatible = "allwinner,sun5i-a10s-pinctrl" }, >> - { .compatible = "allwinner,sun5i-a13-pinctrl" }, ... >> + ID("allwinner,sun4i-a10-pinctrl", a_all), >> + ID("allwinner,sun5i-a10s-pinctrl", a_all), > > I don't think the #define adds a lot of value - consider removing it > an writing things out in full? I originally did that, but you either end up with lines over 80 columns which checkpatch complains about, or multiple lines per entry which makes it harder to read for such a large table. Still, I can convert it if you want.