From patchwork Tue May 31 21:39:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12866188 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 CA9B1C433EF for ; Tue, 31 May 2022 21:39:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348049AbiEaVj1 (ORCPT ); Tue, 31 May 2022 17:39:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242347AbiEaVj0 (ORCPT ); Tue, 31 May 2022 17:39:26 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34FE17356A; Tue, 31 May 2022 14:39:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654033166; x=1685569166; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=+yFy6pGKjBGDEm6WBT//MXILBMPlN1TRcy5qtEEqe+Y=; b=A+qsUG4QJYYFS3nBRP2gSaaF21qALcDeUfTCcXTeGKv6tNUhWJlw9v8e WvB6ingOkm2j+wHv7uCb3fn6D2xFpkOL+uoq85BRcWDMeOh2+XGx69J28 Vpj2Vxr00qxg5U0kgYu5MmuNpJZa1shOnrgKMfTmG2y6RNj7/XYbvamHA /ik1feLjn80jpeXYBdpXKfKR2AY9FgrPG/jzb0vlsRlDeNRDIISsD4zfi KeTISESO3YZI1GKRqVCBF9P0Ycf2qklfbJYCbnH1Iwdb7wltpqOTuAmbd X3k83FCLTCPi4enXxW11niq+hToOh0cUibLJNMfDl65Mb0ttsitt6ibzp Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10364"; a="300743936" X-IronPort-AV: E=Sophos;i="5.91,266,1647327600"; d="scan'208";a="300743936" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 May 2022 14:39:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,266,1647327600"; d="scan'208";a="904160591" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga005.fm.intel.com with ESMTP; 31 May 2022 14:39:24 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 9B9F518B; Wed, 1 Jun 2022 00:39:26 +0300 (EEST) From: Andy Shevchenko To: Alexandru Ardelean , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen , Andy Shevchenko Subject: [PATCH v1 1/2] iio: adc: nau7802: Convert driver to use ->probe_new() Date: Wed, 1 Jun 2022 00:39:21 +0300 Message-Id: <20220531213922.72992-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Use the ->probe_new() callback. The driver does not use const struct i2c_device_id * argument, so convert it to utilise the simplified I²C driver registration. Signed-off-by: Andy Shevchenko --- drivers/iio/adc/nau7802.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/iio/adc/nau7802.c b/drivers/iio/adc/nau7802.c index 976c235f3079..2d71cdbcd82f 100644 --- a/drivers/iio/adc/nau7802.c +++ b/drivers/iio/adc/nau7802.c @@ -407,8 +407,7 @@ static const struct iio_info nau7802_info = { .attrs = &nau7802_attribute_group, }; -static int nau7802_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int nau7802_probe(struct i2c_client *client) { struct iio_dev *indio_dev; struct nau7802_state *st; @@ -417,11 +416,6 @@ static int nau7802_probe(struct i2c_client *client, u8 data; u32 tmp = 0; - if (!client->dev.of_node) { - dev_err(&client->dev, "No device tree node available.\n"); - return -EINVAL; - } - indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*st)); if (indio_dev == NULL) return -ENOMEM; @@ -550,7 +544,7 @@ static const struct of_device_id nau7802_dt_ids[] = { MODULE_DEVICE_TABLE(of, nau7802_dt_ids); static struct i2c_driver nau7802_driver = { - .probe = nau7802_probe, + .probe_new = nau7802_probe, .id_table = nau7802_i2c_id, .driver = { .name = "nau7802", From patchwork Tue May 31 21:39:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12866189 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 231F3C433FE for ; Tue, 31 May 2022 21:39:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348066AbiEaVj2 (ORCPT ); Tue, 31 May 2022 17:39:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239372AbiEaVj0 (ORCPT ); Tue, 31 May 2022 17:39:26 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 349C173553; Tue, 31 May 2022 14:39:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654033166; x=1685569166; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=W3LGc6UbOk46vOqseuqFkVY/oNvVjxu8CVHv7UXo3n8=; b=WhYWn8FklYhVLU/W2xrPIo6q7rP8kB041IRJAuxCUKPeCTCClBY3J6sB VdMInFByGhqGX/pYaOvyW+9H1ITxwGB6PoiXYvNMb/o28ybVsxlw+ySJq oXjXs44IGkkI2C3nrAvRAONA63/6GTq0p70wUwBDfu09vtS/J3CzjOPHt 74mbGXCmlr2G6EBxFJ8i8G1YEB3qrDBAUBDg0ByrHFdes/td7OhPyOPJF xbkvUmw/CSwcUvc/3JGai0wE0t+fftEZHAyC4FP3AJT8pBez1vdIJZmkJ FGWSU9zLmoxqkGK3w8qrCpqPB9UP0393cFSyONFFYKeQFuy7iByW5NoLS w==; X-IronPort-AV: E=McAfee;i="6400,9594,10364"; a="272962029" X-IronPort-AV: E=Sophos;i="5.91,266,1647327600"; d="scan'208";a="272962029" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 May 2022 14:39:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,266,1647327600"; d="scan'208";a="633237026" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 31 May 2022 14:39:24 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id A7F2CD2; Wed, 1 Jun 2022 00:39:26 +0300 (EEST) From: Andy Shevchenko To: Alexandru Ardelean , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen , Andy Shevchenko Subject: [PATCH v1 2/2] iio: adc: nau7802: Make use of device properties Date: Wed, 1 Jun 2022 00:39:22 +0300 Message-Id: <20220531213922.72992-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220531213922.72992-1-andriy.shevchenko@linux.intel.com> References: <20220531213922.72992-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Convert the module to be property provider agnostic and allow it to be used on non-OF platforms. Add mod_devicetable.h include. Signed-off-by: Andy Shevchenko --- drivers/iio/adc/nau7802.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/adc/nau7802.c b/drivers/iio/adc/nau7802.c index 2d71cdbcd82f..c1261ecd400c 100644 --- a/drivers/iio/adc/nau7802.c +++ b/drivers/iio/adc/nau7802.c @@ -8,10 +8,11 @@ #include #include #include +#include #include +#include #include #include -#include #include #include @@ -411,7 +412,6 @@ static int nau7802_probe(struct i2c_client *client) { struct iio_dev *indio_dev; struct nau7802_state *st; - struct device_node *np = client->dev.of_node; int i, ret; u8 data; u32 tmp = 0; @@ -451,7 +451,7 @@ static int nau7802_probe(struct i2c_client *client) if (!(ret & NAU7802_PUCTRL_PUR_BIT)) return ret; - of_property_read_u32(np, "nuvoton,vldo", &tmp); + device_property_read_u32(&client->dev, "nuvoton,vldo", &tmp); st->vref_mv = tmp; data = NAU7802_PUCTRL_PUD_BIT | NAU7802_PUCTRL_PUA_BIT |