From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0ADAC32750 for ; Tue, 13 Aug 2019 13:32:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8C50620663 for ; Tue, 13 Aug 2019 13:32:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729117AbfHMNcr convert rfc822-to-8bit (ORCPT ); Tue, 13 Aug 2019 09:32:47 -0400 Received: from mail-ot1-f67.google.com ([209.85.210.67]:43557 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728095AbfHMNcq (ORCPT ); Tue, 13 Aug 2019 09:32:46 -0400 Received: by mail-ot1-f67.google.com with SMTP id e12so28153236otp.10; Tue, 13 Aug 2019 06:32:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=blr8hsC4CXt5RNI7OKh20qzgOazZxlZ6gz4Viaw7hE8=; b=gMr9413Mr9yWh+2KgM0ENm2pyeUZKi5dv3iogP35LfeuRUmV0TksGtP+Rsz5yS4cHE p+OrhTYtNlpkudxdmFVeGVTATMT9x2dprxMhRluvvMip7tQPYGWRfckBqdEh+vRFRcLA aQj64LS3eMed5e++Y6+TjEHJYm5USpjckP9PLFH4MIEjd98lkxfSPlC2l6mOEWD7MD4h KAFa2lNomOsMvRhEeOmg5EJp0+5tx/pbfD63Y1pASX06wTvQ6qZZ29HrQS+Putx/Om3a spnfFmKfHroRgauP3Moz2t4ePdhbsaskvFT9t/lCUPrD/lYz+dbuiXQwq6bWaLkR3mtJ 8WoQ== X-Gm-Message-State: APjAAAVDTdBBfwsoz9YlYkmrYnjwbry8SzTkmAPh3JXJS8UcmE2JklMv SzPamhsvHS1puPkQqASGNwrYJMCOJ8zzfR6qmdqiUjyf X-Google-Smtp-Source: APXvYqzTRJDeIg0uN8q7lkpd/rdMToHfZRcHOugp+hBk6YJ0KdGcT/SckeR77TGSk+J/QXvFEhleLVWaw8dfFVql0Tw= X-Received: by 2002:a05:6808:3c5:: with SMTP id o5mr1532758oie.102.1565703164877; Tue, 13 Aug 2019 06:32:44 -0700 (PDT) MIME-Version: 1.0 References: <20190812235237.21797-1-max@enpas.org> <20190812235237.21797-3-max@enpas.org> <20190813080237.GA29986@roeck-us.net> <1aff162f-f548-954c-b9d4-c6207a6c5875@roeck-us.net> In-Reply-To: <1aff162f-f548-954c-b9d4-c6207a6c5875@roeck-us.net> From: Geert Uytterhoeven Date: Tue, 13 Aug 2019 15:32:33 +0200 Message-ID: Subject: Re: [PATCH v2 3/4] hwmon/ltc2990: Add platform_data support 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Günter, On Tue, Aug 13, 2019 at 3:27 PM Guenter Roeck wrote: > On 8/13/19 1:27 AM, Geert Uytterhoeven wrote: > > On Tue, Aug 13, 2019 at 10:02 AM Guenter Roeck wrote: > >> On Tue, Aug 13, 2019 at 01:52:36AM +0200, Max Staudt wrote: > >>> This allows code using i2c_new_device() to specify a measurement mode. > >>> > >>> Signed-off-by: Max Staudt > >>> Reviewed-by: Geert Uytterhoeven > >>> --- > >>> drivers/hwmon/ltc2990.c | 9 +++++++++ > >>> include/linux/platform_data/ltc2990.h | 11 +++++++++++ > >>> 2 files changed, 20 insertions(+) > >>> create mode 100644 include/linux/platform_data/ltc2990.h > >>> > >>> diff --git a/drivers/hwmon/ltc2990.c b/drivers/hwmon/ltc2990.c > >>> index f9431ad43..f19b9c50c 100644 > >>> --- a/drivers/hwmon/ltc2990.c > >>> +++ b/drivers/hwmon/ltc2990.c > >>> @@ -14,6 +14,7 @@ > >>> #include > >>> #include > >>> #include > >>> +#include > >>> > >>> #define LTC2990_STATUS 0x00 > >>> #define LTC2990_CONTROL 0x01 > >>> @@ -206,6 +207,7 @@ static int ltc2990_i2c_probe(struct i2c_client *i2c, > >>> int ret; > >>> struct device *hwmon_dev; > >>> struct ltc2990_data *data; > >>> + struct ltc2990_platform_data *pdata = dev_get_platdata(&i2c->dev); > >>> struct device_node *of_node = i2c->dev.of_node; > >>> > >>> if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA | > >>> @@ -227,6 +229,13 @@ static int ltc2990_i2c_probe(struct i2c_client *i2c, > >>> if (data->mode[0] & ~LTC2990_MODE0_MASK || > >>> data->mode[1] & ~LTC2990_MODE1_MASK) > >>> return -EINVAL; > >>> + } else if (pdata) { > >>> + data->mode[0] = pdata->meas_mode[0]; > >>> + data->mode[1] = pdata->meas_mode[1]; > >>> + > >>> + if (data->mode[0] & ~LTC2990_MODE0_MASK || > >>> + data->mode[1] & ~LTC2990_MODE1_MASK) > >>> + return -EINVAL; > >> > >> I would prefer if the driver was modified to accept device > >> properties, and if those were set using the appropriate > >> fwnode function. Any reason for not doing that ? > > > > That was my first thought as well, but isn't that limited to DT and ACPI > > properties (for now)? > > tcpm and, for example, the wcove driver don't seem to have a problem using > it, I don't see acpi involved there. Also, the code resides in the core driver Cool, just discovered that, following your other fwnode_create_software_node() pointer... > code and is always enabled unless I am missing something. What am I missing ? You're missing that I'm not up-to-date w.r.t. the latest fwnode properties development ;-) Thanks a lot! 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