From nobody Tue Dec 16 03:10:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1823C6FA83 for ; Mon, 26 Sep 2022 11:01:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237236AbiIZLBU (ORCPT ); Mon, 26 Sep 2022 07:01:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237232AbiIZK7H (ORCPT ); Mon, 26 Sep 2022 06:59:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 110634E86A; Mon, 26 Sep 2022 03:30:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6934BB80915; Mon, 26 Sep 2022 10:29:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4D6CC433C1; Mon, 26 Sep 2022 10:29:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188162; bh=cK8B3WkbVBAYTuDXLByTeBjLGGmC+KvA8KcRA9a+1JA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pUyiUmyDtwWKg3Z723vcil/m5ZRnJz2VJ03w6XOR6OmAVHNjoCXy0n4Qjnc1Mqnmx N4Raqna8jrHF4+iJ9gssNIygEF7uslENDVpMBH3Paw3r+0y+NS1LUnYv/mnkHUMAsP 8UKo2mbeECytF0PenmHCraJCjdUWurHO/zUZBw2E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Andy Shevchenko , Kent Gustavsson , Marcus Folkesson , Sasha Levin Subject: [PATCH 5.10 020/141] iio:adc:mcp3911: Switch to generic firmware properties. Date: Mon, 26 Sep 2022 12:10:46 +0200 Message-Id: <20220926100755.299003485@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100754.639112000@linuxfoundation.org> References: <20220926100754.639112000@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jonathan Cameron [ Upstream commit 4efc1c614d334883cce09c38aa3fe74d3fb0bbf0 ] This allows use of the driver with other types of firmware such as ACPI PRP0001 based probing. Also part of a general attempt to remove direct use of of_ specific accessors from IIO. Added an include for mod_devicetable.h whilst here to cover the struct of_device_id definition. Signed-off-by: Jonathan Cameron Reviewed-by: Andy Shevchenko Cc: Kent Gustavsson Reviewed-by: Marcus Folkesson Stable-dep-of: cfbd76d5c9c4 ("iio: adc: mcp3911: correct "microchip,device-= addr" property") Signed-off-by: Sasha Levin --- drivers/iio/adc/mcp3911.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/iio/adc/mcp3911.c b/drivers/iio/adc/mcp3911.c index 65278270a75c..608842632925 100644 --- a/drivers/iio/adc/mcp3911.c +++ b/drivers/iio/adc/mcp3911.c @@ -10,6 +10,8 @@ #include #include #include +#include +#include #include #include =20 @@ -209,12 +211,13 @@ static const struct iio_info mcp3911_info =3D { .write_raw =3D mcp3911_write_raw, }; =20 -static int mcp3911_config(struct mcp3911 *adc, struct device_node *of_node) +static int mcp3911_config(struct mcp3911 *adc) { + struct device *dev =3D &adc->spi->dev; u32 configreg; int ret; =20 - of_property_read_u32(of_node, "device-addr", &adc->dev_addr); + device_property_read_u32(dev, "device-addr", &adc->dev_addr); if (adc->dev_addr > 3) { dev_err(&adc->spi->dev, "invalid device address (%i). Must be in range 0-3.\n", @@ -298,7 +301,7 @@ static int mcp3911_probe(struct spi_device *spi) } } =20 - ret =3D mcp3911_config(adc, spi->dev.of_node); + ret =3D mcp3911_config(adc); if (ret) goto clk_disable; =20 --=20 2.35.1