From nobody Sat Jul 25 05:59:50 2026 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 565D63BED26 for ; Fri, 17 Jul 2026 06:37:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784270270; cv=none; b=Qo2AKZSBkSkfaUMj2fK/PpHdpzF+YVnVr69OI2OajlTgXhaLTH2dSdSbE5rc4y3PfkCOXJvInhwbEvzR4X+j410opoqE34j1hBPAX2it4uNxwX8bg+p6qrciR6JkGFDip8GF01eztThF2xzMjKNQFILG1ZQBPKhD0LSLhnktPFA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784270270; c=relaxed/simple; bh=ReeEoEQsYvmBjZWQgRR92CM+SJ2darMxK748g9KMECo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=todR3M4UDkKPZX3fhIQSFvE/45LHda/zpd8zMLN1WMZSgfc6S+MkO064frmWQ/ZrI741M848Bqucw/SIxgMTw8/bAl2sxbwHYYstb4MeHHjdKDXaVoyoWtT6v7IcXGjfVF6P94oKVTn733nyFKyWxbFvlKB+ZFNiEM0G45Mz21E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=H0R723zm; arc=none smtp.client-ip=209.85.128.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="H0R723zm" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-493f75f7172so55388095e9.1 for ; Thu, 16 Jul 2026 23:37:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784270264; x=1784875064; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=3qM+aWftc8PoPosfqPaRZSyph/d44ipOqM5LtqJstHI=; b=H0R723zmyHOIEHqyYTOh3zNncEhoxP3/7awfTjIxkx1HD5cscfPOOaEtSWnGP0LQPf N2To9o/oStummgCJpPHwIW56cEfFnimJUPMFyZElsA5pRKTK4vFgFYnmZnPNE2xiK0OF YGEO7K5XEYdSstTh4P66v0EL9/xHRnYUSOHGHQLLHfP9cV53xPjN7Y7j5t4VMpJWRiYA XJfN9HJjs5EeHSVrEkaCswOwyBjeVp7RaH04gUDVA7Udh6rS3JZu2+3AowsDzecma2e2 27Yh2R2JTs9nTUsYjLe7LFxMuai90hKQY+zoXX8toiYq3AGI9x+M7UtZEUNB/C6efwc6 I30Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784270264; x=1784875064; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=3qM+aWftc8PoPosfqPaRZSyph/d44ipOqM5LtqJstHI=; b=MlLYro9m6czI85jT00DRrreeBP0Dzyh4H72STuUSNKVaBgjC+rg5yFUzI7bA9NUSvZ M9fK4zLlt4j3gAnzNx2o+5fAMu8VvulVdGrWN2IEPOoM0hKkDld8BjePlFU5NjfVpm3K 9RDxKy1FefWf4Yw6FSshaRZTJTY+hG00aiBHI+DejVzFAmtXuwkAloyrgKerBgtGuS7C 0JyCVtQqfiA8hM4pQ2GfvjPy9oZH88sz/GsXwWByXFSjWnmSevsgY86fva7yLF0CkfOM g5S2LVGS/oxnUbSibOGQ+PYUVXYg/UVWFnazhOl4p0KfymjC07P/jJ+p1xhV8zmYsBAP 6Dyw== X-Forwarded-Encrypted: i=1; AHgh+Rpbj5YZ2BmynGzkuG/JYsWctrydk9lKnMNy87KyacIBxZ4LYADID2JtbsKe0IyYyAyXnH38tMoObZq2Tj4=@vger.kernel.org X-Gm-Message-State: AOJu0YwEnwGyN2/H8SJnyJpBc1rcL6HI9epC5Mq1fHZC9ERq3EBaLhQa THfh45fVOHQW2AblFEVEYq0sw4vVWmSiWAf58QhiF+ORJgZimO4Q1Ip/ X-Gm-Gg: AfdE7ckzBhpAj7AC4OjxCnSTP7rVRk1gnjlVH1BF9ycYomWufaVP1VYsXu7ghW6NLpz b65BStM+a2obROkK5F/Hi46+HvXDh4dXa0mHvojM0hbAE5hZcEudyM8n3BHTh3y8WOcXWhwZ3D2 x5N7dxKwwBfakLH9av79CCBRA6bPhJoaCey4olHtkm2+6uctCP9IeyFohHSabXq7VwfgawBRXkz juhn3uQH32s77EzuxO2P0UiOIYBXbUUx2K2BM1mYsqGWiru/sk5T4ayTwrcdcLWM+OrXcKEDARf gbN0ukh4P3W9Xcj4nRVqK6Ed+VuT3CCKm5nfdvk8sIoDQj4luw6xzHOKKYVNEj8CgL9XDTi/yKQ I4hIqM1lO0TS8OEOmddznwoWBwSTnaAnxMcRLTIOZkLsL1q0yp/6D1LJydLm5oq8Bor541xXYxG f2t9a8iDHwnlYJwLHfm7wR+7LQuRbLIpTGiRWa7KPoshNCQA29D6heEBI= X-Received: by 2002:a05:600c:4691:b0:493:c47f:3c55 with SMTP id 5b1f17b1804b1-4954a3e20a6mr12918325e9.5.1784270263423; Thu, 16 Jul 2026 23:37:43 -0700 (PDT) Received: from flaviu-Aspire-E5-572G.. ([93.122.248.125]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4954966a033sm22207295e9.0.2026.07.16.23.37.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2026 23:37:42 -0700 (PDT) From: Flaviu Nistor To: Guenter Roeck , Jean Delvare Cc: Flaviu Nistor , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] hwmon: (lm90) Switch channel parsing to fwnode APIs Date: Fri, 17 Jul 2026 09:37:30 +0300 Message-ID: <20260717063730.5617-1-flaviu.nistor@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Replace OF property handling with fwnode in the probe function to read the channels properties, improving the driver compatibility since this method is not limited to Device Tree only. Add also the needed headers for explicit include and clean up related function naming. Signed-off-by: Flaviu Nistor --- Changes in v2: - Remove as suggested by Uwe Kleine-Konig.=20 - Link to v1: https://lore.kernel.org/all/20260713190659.4511-1-flaviu.nist= or@gmail.com/ drivers/hwmon/lm90.c | 47 +++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index 4b9c0ccdf260..7d4b8e61bec5 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c @@ -101,6 +101,7 @@ #include #include #include +#include #include #include #include @@ -108,7 +109,7 @@ #include #include #include -#include +#include #include #include #include @@ -295,7 +296,7 @@ static const struct i2c_device_id lm90_id[] =3D { }; MODULE_DEVICE_TABLE(i2c, lm90_id); =20 -static const struct of_device_id __maybe_unused lm90_of_match[] =3D { +static const struct of_device_id lm90_of_match[] =3D { { .compatible =3D "adi,adm1032", .data =3D (void *)adm1032 @@ -2602,7 +2603,6 @@ static void lm90_stop_work(void *_data) =20 static int lm90_init_client(struct i2c_client *client, struct lm90_data *d= ata) { - struct device_node *np =3D client->dev.of_node; int config, convrate; =20 if (data->flags & LM90_HAVE_CONVRATE) { @@ -2626,7 +2626,7 @@ static int lm90_init_client(struct i2c_client *client= , struct lm90_data *data) =20 /* Check Temperature Range Select */ if (data->flags & LM90_HAVE_EXTENDED_TEMP) { - if (of_property_read_bool(np, "ti,extended-range-enable")) + if (device_property_read_bool(&client->dev, "ti,extended-range-enable")) config |=3D 0x04; if (!(config & 0x04)) data->flags &=3D ~LM90_HAVE_EXTENDED_TEMP; @@ -2692,8 +2692,8 @@ static irqreturn_t lm90_irq_thread(int irq, void *dev= _id) return IRQ_NONE; } =20 -static int lm90_probe_channel_from_dt(struct i2c_client *client, - struct device_node *child, +static int lm90_probe_channel(struct i2c_client *client, + struct fwnode_handle *child, struct lm90_data *data) { u32 id; @@ -2701,27 +2701,27 @@ static int lm90_probe_channel_from_dt(struct i2c_cl= ient *client, int err; struct device *dev =3D &client->dev; =20 - err =3D of_property_read_u32(child, "reg", &id); + err =3D fwnode_property_read_u32(child, "reg", &id); if (err) { - dev_err(dev, "missing reg property of %pOFn\n", child); + dev_err(dev, "missing reg property of %pfw\n", child); return err; } =20 if (id >=3D MAX_CHANNELS) { - dev_err(dev, "invalid reg property value %d in %pOFn\n", id, child); + dev_err(dev, "invalid reg property value %d in %pfw\n", id, child); return -EINVAL; } =20 - err =3D of_property_read_string(child, "label", &data->channel_label[id]); + err =3D fwnode_property_read_string(child, "label", &data->channel_label[= id]); if (err =3D=3D -ENODATA || err =3D=3D -EILSEQ) { - dev_err(dev, "invalid label property in %pOFn\n", child); + dev_err(dev, "invalid label property in %pfw\n", child); return err; } =20 if (data->channel_label[id]) data->channel_config[id] |=3D HWMON_T_LABEL; =20 - err =3D of_property_read_s32(child, "temperature-offset-millicelsius", &v= al); + err =3D fwnode_property_read_u32(child, "temperature-offset-millicelsius"= , &val); if (!err) { if (id =3D=3D 0) { dev_err(dev, "temperature-offset-millicelsius can't be set for internal= channel\n"); @@ -2739,18 +2739,17 @@ static int lm90_probe_channel_from_dt(struct i2c_cl= ient *client, return 0; } =20 -static int lm90_parse_dt_channel_info(struct i2c_client *client, - struct lm90_data *data) +static int lm90_parse_channel_info(struct i2c_client *client, + struct lm90_data *data) { int err; struct device *dev =3D &client->dev; - const struct device_node *np =3D dev->of_node; =20 - for_each_child_of_node_scoped(np, child) { - if (strcmp(child->name, "channel")) + device_for_each_child_node_scoped(dev, child) { + if (!fwnode_name_eq(child, "channel")) continue; =20 - err =3D lm90_probe_channel_from_dt(client, child, data); + err =3D lm90_probe_channel(client, child, data); if (err) return err; } @@ -2887,12 +2886,10 @@ static int lm90_probe(struct i2c_client *client) /* Set maximum conversion rate */ data->max_convrate =3D lm90_params[data->kind].max_convrate; =20 - /* Parse device-tree channel information */ - if (client->dev.of_node) { - err =3D lm90_parse_dt_channel_info(client, data); - if (err) - return err; - } + /* Parse channel information */ + err =3D lm90_parse_channel_info(client, data); + if (err) + return err; =20 /* Initialize the LM90 chip */ err =3D lm90_init_client(client, data); @@ -2985,7 +2982,7 @@ static struct i2c_driver lm90_driver =3D { .class =3D I2C_CLASS_HWMON, .driver =3D { .name =3D "lm90", - .of_match_table =3D of_match_ptr(lm90_of_match), + .of_match_table =3D lm90_of_match, .pm =3D pm_sleep_ptr(&lm90_pm_ops), }, .probe =3D lm90_probe, --=20 2.34.1