From mboxrd@z Thu Jan 1 00:00:00 1970 From: Geert Uytterhoeven Subject: Re: [PATCH v3 2/3] hwmon/ltc2990: Generalise DT to fwnode support Date: Fri, 16 Aug 2019 09:32:46 +0200 Message-ID: References: <20190815125802.16500-1-max@enpas.org> <20190815125802.16500-2-max@enpas.org> <6920f2da-3139-6fc8-b02c-3678cc17912e@enpas.org> <20190815224341.GA12420@roeck-us.net> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: In-Reply-To: <20190815224341.GA12420@roeck-us.net> Sender: linux-kernel-owner@vger.kernel.org To: Guenter Roeck Cc: Max Staudt , Linux I2C , linux-hwmon@vger.kernel.org, Wolfram Sang , Jean Delvare , Linux/m68k , Linux Kernel Mailing List , John Paul Adrian Glaubitz List-Id: linux-m68k@vger.kernel.org On Fri, Aug 16, 2019 at 1:50 AM Guenter Roeck wrote: > On Fri, Aug 16, 2019 at 12:19:42AM +0200, Max Staudt wrote: > > On 08/15/2019 02:58 PM, Max Staudt wrote: > > > - if (of_node) { > > > - ret = of_property_read_u32_array(of_node, "lltc,meas-mode", > > > - data->mode, 2); > > > + if (i2c->dev.of_node || i2c->dev.fwnode) { I was just going to comment on this check... > > One more idea, would it be better here to do the following? > > > > if (device_property_present(i2c->dev, "lltc,meas-mode")) { > > ret = of_property_read_u32_array(of_node, "lltc,meas-mode", > > data->mode, 2); > > } > > > > I'm happy to prepare a patch if you wish to have this in - just let me know whether it should be on top of the last one, or instead of it. > > That would be semantically different. The property is currently mandatory. > The above code would make it optional. This might work: > > if (dev_fwnode(&i2c->dev)) { > ret = device_property_read_u32_array(...); > ... > } Much better, thanks! Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds