From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752526AbcF1OcX (ORCPT ); Tue, 28 Jun 2016 10:32:23 -0400 Received: from mail1.asahi-net.or.jp ([202.224.39.197]:42638 "EHLO mail1.asahi-net.or.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752133AbcF1OcW (ORCPT ); Tue, 28 Jun 2016 10:32:22 -0400 Date: Tue, 28 Jun 2016 23:32:20 +0900 Message-ID: <87k2h9z8nf.wl-ysato@users.sourceforge.jp> From: Yoshinori Sato To: Lee Jones Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH] sm501: Add device property In-Reply-To: <20160628074908.GI6720@dell> References: <1467097170-6087-1-git-send-email-ysato@users.sourceforge.jp> <20160628074908.GI6720@dell> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL/10.8 EasyPG/1.0.0 Emacs/24.5 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=ISO-2022-JP Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 28 Jun 2016 16:49:08 +0900, Lee Jones wrote: > > On Tue, 28 Jun 2016, Yoshinori Sato wrote: > > > This driver have configuration parameter "device" in platform_data. > > But don't have it in devicetree. > > > > This patch add "device" configuration to devicetree. > > This is really ugly. I don't know details, either, so it may be wrong. > 1. Where are you documenting the binding? It looks remove of commit 4295f9bf74a885da390abc49a3b42a011c1bb890. Revert. > 2. Just because it's in platform data, it doesn't mean it lives in DT SM501's devicetree support only framebuffer module. This property not needed only framebuffer. > 3. Does this code even work? > Won't private_platdata get freed when you leave probe()? Yes. This code works RTS7751R2D (SH4). > 4. Where is 'devices' consumed? It used "sm501_init_dev". I'll sent v2/ Thanks. > > Signed-off-by: Yoshinori Sato > > --- > > drivers/mfd/sm501.c | 9 +++++++++ > > 1 file changed, 9 insertions(+) > > > > diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c > > index 65cd0d2..e2e3f9b 100644 > > --- a/drivers/mfd/sm501.c > > +++ b/drivers/mfd/sm501.c > > @@ -21,6 +21,7 @@ > > #include > > #include > > #include > > +#include > > > > #include > > #include > > @@ -1377,6 +1378,8 @@ static int sm501_plat_probe(struct platform_device *dev) > > { > > struct sm501_devdata *sm; > > int ret; > > + struct sm501_platdata private_platdata; > > + struct sm501_initdata private_initdata; > > > > sm = kzalloc(sizeof(struct sm501_devdata), GFP_KERNEL); > > if (sm == NULL) { > > @@ -1388,6 +1391,12 @@ static int sm501_plat_probe(struct platform_device *dev) > > sm->dev = &dev->dev; > > sm->pdev_id = dev->id; > > sm->platdata = dev_get_platdata(&dev->dev); > > + if (!sm->platdata) { > > + of_property_read_u32(dev->dev.of_node, "smi,devices", > > + (u32 *)&private_initdata.devices); > > + private_platdata.init = &private_initdata; > > + sm->platdata = &private_platdata; > > + } > > > > ret = platform_get_irq(dev, 0); > > if (ret < 0) { > > -- > Lee Jones > Linaro STMicroelectronics Landing Team Lead > Linaro.org │ Open source software for ARM SoCs > Follow Linaro: Facebook | Twitter | Blog -- Yoshinori Sato