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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCFE4C32771 for ; Mon, 26 Sep 2022 10:45:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236326AbiIZKpM (ORCPT ); Mon, 26 Sep 2022 06:45:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236201AbiIZKm5 (ORCPT ); Mon, 26 Sep 2022 06:42:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 491FB18E24; Mon, 26 Sep 2022 03:24:21 -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 4C2F8B80915; Mon, 26 Sep 2022 10:23:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FBC7C433C1; Mon, 26 Sep 2022 10:23:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187833; bh=vSdOEAMstmSmfi3lFpIiRMp77RLfuMXmUwhvpHUwSLg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G1FJf31N8W013+wnJtBFSTrwuML3r9kwchZefiWuredUO2uFA7MVdeeUab10oBD2C lnoXwbrxrbi+6zBQY+9j5zQ4UCFIWRMBELXqMCHhPeXoVsHkVgRcjCChtZABYluKlF stp9XIKVouK+gebxC7n6b7xmiLGj6Lj2Uuf6bs74= 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.4 042/120] iio:adc:mcp3911: Switch to generic firmware properties. Date: Mon, 26 Sep 2022 12:11:15 +0200 Message-Id: <20220926100752.250813953@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 4e2e8e819b1e..cd8b1bab9cf0 100644 --- a/drivers/iio/adc/mcp3911.c +++ b/drivers/iio/adc/mcp3911.c @@ -10,6 +10,8 @@ #include #include #include +#include +#include #include #include @@ -209,12 +211,13 @@ static const struct iio_info mcp3911_info = { .write_raw = mcp3911_write_raw, }; -static int mcp3911_config(struct mcp3911 *adc, struct device_node *of_node) +static int mcp3911_config(struct mcp3911 *adc) { + struct device *dev = &adc->spi->dev; u32 configreg; int ret; - 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) } } - ret = mcp3911_config(adc, spi->dev.of_node); + ret = mcp3911_config(adc); if (ret) goto clk_disable; -- 2.35.1