From patchwork Mon Dec 16 17:38:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11294883 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0A5B9109A for ; Mon, 16 Dec 2019 17:39:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E3F90206D7 for ; Mon, 16 Dec 2019 17:39:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726436AbfLPRjH (ORCPT ); Mon, 16 Dec 2019 12:39:07 -0500 Received: from mga02.intel.com ([134.134.136.20]:2604 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726181AbfLPRjH (ORCPT ); Mon, 16 Dec 2019 12:39:07 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Dec 2019 09:38:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,322,1571727600"; d="scan'208";a="266317694" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 16 Dec 2019 09:38:56 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id DE6FB12A; Mon, 16 Dec 2019 19:38:54 +0200 (EET) From: Andy Shevchenko To: Jonathan Cameron , linux-iio@vger.kernel.org, Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler Cc: Andy Shevchenko Subject: [PATCH v1 1/9] iio: light: st_uvis25: Drop unneeded header inclusion Date: Mon, 16 Dec 2019 19:38:45 +0200 Message-Id: <20191216173853.75797-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org There is no evidence that the driver supports or needs ACPI APIs. Signed-off-by: Andy Shevchenko --- drivers/iio/light/st_uvis25_i2c.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/iio/light/st_uvis25_i2c.c b/drivers/iio/light/st_uvis25_i2c.c index dacbac6a6662..4889bbeb0c73 100644 --- a/drivers/iio/light/st_uvis25_i2c.c +++ b/drivers/iio/light/st_uvis25_i2c.c @@ -9,7 +9,6 @@ #include #include -#include #include #include #include From patchwork Mon Dec 16 17:38:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11294875 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5A92717F0 for ; Mon, 16 Dec 2019 17:39:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 428E42072B for ; Mon, 16 Dec 2019 17:39:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726313AbfLPRi7 (ORCPT ); Mon, 16 Dec 2019 12:38:59 -0500 Received: from mga04.intel.com ([192.55.52.120]:19438 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726275AbfLPRi7 (ORCPT ); Mon, 16 Dec 2019 12:38:59 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Dec 2019 09:38:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,322,1571727600"; d="scan'208";a="217493069" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 16 Dec 2019 09:38:56 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id EB80645; Mon, 16 Dec 2019 19:38:54 +0200 (EET) From: Andy Shevchenko To: Jonathan Cameron , linux-iio@vger.kernel.org, Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler Cc: Andy Shevchenko Subject: [PATCH v1 2/9] iio: accel: st_accel: Drop unnecessary #else branch for ACPI Date: Mon, 16 Dec 2019 19:38:46 +0200 Message-Id: <20191216173853.75797-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191216173853.75797-1-andriy.shevchenko@linux.intel.com> References: <20191216173853.75797-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org ACPI_PTR() takes care of the argument in case of !CONFIG_ACPI. Remove unnecessary #else branch. Signed-off-by: Andy Shevchenko --- drivers/iio/accel/st_accel_i2c.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/iio/accel/st_accel_i2c.c b/drivers/iio/accel/st_accel_i2c.c index 50fa0fc32baa..0f4aef5448e7 100644 --- a/drivers/iio/accel/st_accel_i2c.c +++ b/drivers/iio/accel/st_accel_i2c.c @@ -119,8 +119,6 @@ static const struct acpi_device_id st_accel_acpi_match[] = { { }, }; MODULE_DEVICE_TABLE(acpi, st_accel_acpi_match); -#else -#define st_accel_acpi_match NULL #endif static const struct i2c_device_id st_accel_id_table[] = { From patchwork Mon Dec 16 17:38:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11294869 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3AEDC109A for ; Mon, 16 Dec 2019 17:38:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1796220726 for ; Mon, 16 Dec 2019 17:38:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726263AbfLPRi6 (ORCPT ); Mon, 16 Dec 2019 12:38:58 -0500 Received: from mga11.intel.com ([192.55.52.93]:14035 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726141AbfLPRi6 (ORCPT ); Mon, 16 Dec 2019 12:38:58 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Dec 2019 09:38:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,322,1571727600"; d="scan'208";a="240111554" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga004.fm.intel.com with ESMTP; 16 Dec 2019 09:38:56 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id F355B238; Mon, 16 Dec 2019 19:38:54 +0200 (EET) From: Andy Shevchenko To: Jonathan Cameron , linux-iio@vger.kernel.org, Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler Cc: Andy Shevchenko Subject: [PATCH v1 3/9] iio: pressure: st_press: Drop unnecessary #else branch for ACPI Date: Mon, 16 Dec 2019 19:38:47 +0200 Message-Id: <20191216173853.75797-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191216173853.75797-1-andriy.shevchenko@linux.intel.com> References: <20191216173853.75797-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org ACPI_PTR() takes care of the argument in case of !CONFIG_ACPI. Remove unnecessary #else branch. Signed-off-by: Andy Shevchenko --- drivers/iio/pressure/st_pressure_i2c.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/iio/pressure/st_pressure_i2c.c b/drivers/iio/pressure/st_pressure_i2c.c index 71d2ed6b4948..6203bc9d5c2d 100644 --- a/drivers/iio/pressure/st_pressure_i2c.c +++ b/drivers/iio/pressure/st_pressure_i2c.c @@ -61,8 +61,6 @@ static const struct acpi_device_id st_press_acpi_match[] = { { }, }; MODULE_DEVICE_TABLE(acpi, st_press_acpi_match); -#else -#define st_press_acpi_match NULL #endif static const struct i2c_device_id st_press_id_table[] = { From patchwork Mon Dec 16 17:38:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11294871 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6507D17F0 for ; Mon, 16 Dec 2019 17:38:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 42EF020726 for ; Mon, 16 Dec 2019 17:38:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726141AbfLPRi6 (ORCPT ); Mon, 16 Dec 2019 12:38:58 -0500 Received: from mga12.intel.com ([192.55.52.136]:10948 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726227AbfLPRi6 (ORCPT ); Mon, 16 Dec 2019 12:38:58 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Dec 2019 09:38:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,322,1571727600"; d="scan'208";a="247116666" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga002.fm.intel.com with ESMTP; 16 Dec 2019 09:38:56 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 0DB5324C; Mon, 16 Dec 2019 19:38:55 +0200 (EET) From: Andy Shevchenko To: Jonathan Cameron , linux-iio@vger.kernel.org, Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler Cc: Andy Shevchenko Subject: [PATCH v1 4/9] iio: gyro: st_gyro: Mark gyro_pdata with __maybe_unused Date: Mon, 16 Dec 2019 19:38:48 +0200 Message-Id: <20191216173853.75797-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191216173853.75797-1-andriy.shevchenko@linux.intel.com> References: <20191216173853.75797-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Since we put static variable to a header file it's copied to each module that includes the header. But not all of them are actually used it. Mark gyro_pdata with __maybe_unused to calm a compiler down: In file included from drivers/iio/gyro/st_gyro_i2c.c:18: drivers/iio/gyro/st_gyro.h:31:46: warning: ‘gyro_pdata’ defined but not used [-Wunused-const-variable=] 31 | static const struct st_sensors_platform_data gyro_pdata = { | ^~~~~~~~~~ ... Signed-off-by: Andy Shevchenko --- drivers/iio/gyro/st_gyro.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/gyro/st_gyro.h b/drivers/iio/gyro/st_gyro.h index 592f6b34e987..fd9171cc3aba 100644 --- a/drivers/iio/gyro/st_gyro.h +++ b/drivers/iio/gyro/st_gyro.h @@ -28,7 +28,7 @@ * struct st_sensors_platform_data - gyro platform data * @drdy_int_pin: DRDY on gyros is available only on INT2 pin. */ -static const struct st_sensors_platform_data gyro_pdata = { +static __maybe_unused const struct st_sensors_platform_data gyro_pdata = { .drdy_int_pin = 2, }; From patchwork Mon Dec 16 17:38:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11294873 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 38FCB6C1 for ; Mon, 16 Dec 2019 17:39:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 16D3C20726 for ; Mon, 16 Dec 2019 17:39:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726275AbfLPRi7 (ORCPT ); Mon, 16 Dec 2019 12:38:59 -0500 Received: from mga01.intel.com ([192.55.52.88]:35383 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726227AbfLPRi7 (ORCPT ); Mon, 16 Dec 2019 12:38:59 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Dec 2019 09:38:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,322,1571727600"; d="scan'208";a="416515648" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga006.fm.intel.com with ESMTP; 16 Dec 2019 09:38:56 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 1346C217; Mon, 16 Dec 2019 19:38:55 +0200 (EET) From: Andy Shevchenko To: Jonathan Cameron , linux-iio@vger.kernel.org, Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler Cc: Andy Shevchenko Subject: [PATCH v1 5/9] iio: accel: st_accel: Mark default_accel_pdata with __maybe_unused Date: Mon, 16 Dec 2019 19:38:49 +0200 Message-Id: <20191216173853.75797-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191216173853.75797-1-andriy.shevchenko@linux.intel.com> References: <20191216173853.75797-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Since we put static variable to a header file it's copied to each module that includes the header. But not all of them are actually used it. Mark default_accel_pdata with __maybe_unused to calm a compiler down: In file included from drivers/iio/accel/st_accel_i2c.c:19: drivers/iio/accel/st_accel.h:67:46: warning: ‘default_accel_pdata’ defined but not used [-Wunused-const-variable=] 67 | static const struct st_sensors_platform_data default_accel_pdata = { | ^~~~~~~~~~~~~~~~~~~ ... Signed-off-by: Andy Shevchenko --- drivers/iio/accel/st_accel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/accel/st_accel.h b/drivers/iio/accel/st_accel.h index af09943f38c9..5b13e293cade 100644 --- a/drivers/iio/accel/st_accel.h +++ b/drivers/iio/accel/st_accel.h @@ -64,7 +64,7 @@ enum st_accel_type { * struct st_sensors_platform_data - default accel platform data * @drdy_int_pin: default accel DRDY is available on INT1 pin. */ -static const struct st_sensors_platform_data default_accel_pdata = { +static __maybe_unused const struct st_sensors_platform_data default_accel_pdata = { .drdy_int_pin = 1, }; From patchwork Mon Dec 16 17:38:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11294881 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DEDD56C1 for ; Mon, 16 Dec 2019 17:39:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BCF0A20717 for ; Mon, 16 Dec 2019 17:39:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726426AbfLPRjC (ORCPT ); Mon, 16 Dec 2019 12:39:02 -0500 Received: from mga11.intel.com ([192.55.52.93]:14035 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726526AbfLPRjB (ORCPT ); Mon, 16 Dec 2019 12:39:01 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Dec 2019 09:39:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,322,1571727600"; d="scan'208";a="227187255" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 16 Dec 2019 09:38:59 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 227193A0; Mon, 16 Dec 2019 19:38:55 +0200 (EET) From: Andy Shevchenko To: Jonathan Cameron , linux-iio@vger.kernel.org, Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler Cc: Andy Shevchenko Subject: [PATCH v1 6/9] iio: pressure: st_press: Mark default_press_pdata with __maybe_unused Date: Mon, 16 Dec 2019 19:38:50 +0200 Message-Id: <20191216173853.75797-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191216173853.75797-1-andriy.shevchenko@linux.intel.com> References: <20191216173853.75797-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Since we put static variable to a header file it's copied to each module that includes the header. But not all of them are actually used it. Mark default_press_pdata with __maybe_unused to calm a compiler down: In file included from drivers/iio/pressure/st_pressure_spi.c:18: drivers/iio/pressure/st_pressure.h:40:46: warning: ‘default_press_pdata’ defined but not used [-Wunused-const-variable=] 40 | static const struct st_sensors_platform_data default_press_pdata = { | ^~~~~~~~~~~~~~~~~~~ ... Signed-off-by: Andy Shevchenko --- drivers/iio/pressure/st_pressure.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/pressure/st_pressure.h b/drivers/iio/pressure/st_pressure.h index c2e47a6c3118..5c746ff6087e 100644 --- a/drivers/iio/pressure/st_pressure.h +++ b/drivers/iio/pressure/st_pressure.h @@ -37,7 +37,7 @@ enum st_press_type { * struct st_sensors_platform_data - default press platform data * @drdy_int_pin: default press DRDY is available on INT1 pin. */ -static const struct st_sensors_platform_data default_press_pdata = { +static __maybe_unused const struct st_sensors_platform_data default_press_pdata = { .drdy_int_pin = 1, }; From patchwork Mon Dec 16 17:38:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11294877 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F3664109A for ; Mon, 16 Dec 2019 17:39:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DB5B32072D for ; Mon, 16 Dec 2019 17:39:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726520AbfLPRjB (ORCPT ); Mon, 16 Dec 2019 12:39:01 -0500 Received: from mga04.intel.com ([192.55.52.120]:19438 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726227AbfLPRjB (ORCPT ); Mon, 16 Dec 2019 12:39:01 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Dec 2019 09:39:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,322,1571727600"; d="scan'208";a="221543290" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 16 Dec 2019 09:38:59 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 27EE42E6; Mon, 16 Dec 2019 19:38:55 +0200 (EET) From: Andy Shevchenko To: Jonathan Cameron , linux-iio@vger.kernel.org, Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler Cc: Andy Shevchenko Subject: [PATCH v1 7/9] iio: st_sensors: Describe function parameters in kernel-doc Date: Mon, 16 Dec 2019 19:38:51 +0200 Message-Id: <20191216173853.75797-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191216173853.75797-1-andriy.shevchenko@linux.intel.com> References: <20191216173853.75797-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Kernel documentation script complains that some of the function parameters are not described: .../common/st_sensors/st_sensors_trigger.c:29: warning: Function parameter or member 'indio_dev' not described in 'st_sensors_new_samples_available' .../common/st_sensors/st_sensors_trigger.c:29: warning: Function parameter or member 'sdata' not described in 'st_sensors_new_samples_available' Describe function parameters where it's appropriate. Signed-off-by: Andy Shevchenko --- drivers/iio/common/st_sensors/st_sensors_trigger.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/iio/common/st_sensors/st_sensors_trigger.c b/drivers/iio/common/st_sensors/st_sensors_trigger.c index 4a2efa00f7f2..e817537cdfb5 100644 --- a/drivers/iio/common/st_sensors/st_sensors_trigger.c +++ b/drivers/iio/common/st_sensors/st_sensors_trigger.c @@ -19,6 +19,9 @@ /** * st_sensors_new_samples_available() - check if more samples came in + * @indio_dev: IIO device reference. + * @sdata: Sensor data. + * * returns: * 0 - no new samples available * 1 - new samples available From patchwork Mon Dec 16 17:38:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11294887 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CEA6C6C1 for ; Mon, 16 Dec 2019 17:40:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A0C58206EC for ; Mon, 16 Dec 2019 17:40:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726281AbfLPRkW (ORCPT ); Mon, 16 Dec 2019 12:40:22 -0500 Received: from mga17.intel.com ([192.55.52.151]:37441 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726263AbfLPRkV (ORCPT ); Mon, 16 Dec 2019 12:40:21 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Dec 2019 09:39:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,322,1571727600"; d="scan'208";a="365088535" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga004.jf.intel.com with ESMTP; 16 Dec 2019 09:38:59 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 36D61628; Mon, 16 Dec 2019 19:38:55 +0200 (EET) From: Andy Shevchenko To: Jonathan Cameron , linux-iio@vger.kernel.org, Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler Cc: Andy Shevchenko Subject: [PATCH v1 8/9] iio: st_sensors: Drop redundant parameter from st_sensors_of_name_probe() Date: Mon, 16 Dec 2019 19:38:52 +0200 Message-Id: <20191216173853.75797-8-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191216173853.75797-1-andriy.shevchenko@linux.intel.com> References: <20191216173853.75797-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Since we have access to the struct device_driver and thus to the ID table, there is no need to supply special parameters to st_sensors_of_name_probe(). Besides that we have a common API to get driver match data, there is no need to do matching separately for OF and ACPI. Taking into consideration above, simplify the ST sensors code. Signed-off-by: Andy Shevchenko --- drivers/iio/accel/st_accel_spi.c | 3 +- .../iio/common/st_sensors/st_sensors_core.c | 38 +++++++++---------- .../iio/common/st_sensors/st_sensors_i2c.c | 21 ---------- drivers/iio/gyro/st_gyro_i2c.c | 3 +- drivers/iio/gyro/st_gyro_spi.c | 3 +- drivers/iio/magnetometer/st_magn_i2c.c | 3 +- drivers/iio/magnetometer/st_magn_spi.c | 3 +- drivers/iio/pressure/st_pressure_i2c.c | 14 +------ drivers/iio/pressure/st_pressure_spi.c | 3 +- include/linux/iio/common/st_sensors.h | 12 +----- include/linux/iio/common/st_sensors_i2c.h | 10 ----- 11 files changed, 25 insertions(+), 88 deletions(-) diff --git a/drivers/iio/accel/st_accel_spi.c b/drivers/iio/accel/st_accel_spi.c index 8af7027d5598..3e25268638e2 100644 --- a/drivers/iio/accel/st_accel_spi.c +++ b/drivers/iio/accel/st_accel_spi.c @@ -107,8 +107,7 @@ static int st_accel_spi_probe(struct spi_device *spi) struct iio_dev *indio_dev; int err; - st_sensors_of_name_probe(&spi->dev, st_accel_of_match, - spi->modalias, sizeof(spi->modalias)); + st_sensors_dev_name_probe(&spi->dev, spi->modalias, sizeof(spi->modalias)); settings = st_accel_get_settings(spi->modalias); if (!settings) { diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c index 4a3064fb6cd9..42a71a50650f 100644 --- a/drivers/iio/common/st_sensors/st_sensors_core.c +++ b/drivers/iio/common/st_sensors/st_sensors_core.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -340,42 +341,37 @@ static struct st_sensors_platform_data *st_sensors_of_probe(struct device *dev, return pdata; } +#else +static struct st_sensors_platform_data *st_sensors_of_probe(struct device *dev, + struct st_sensors_platform_data *defdata) +{ + return NULL; +} +#endif /** - * st_sensors_of_name_probe() - device tree probe for ST sensor name + * st_sensors_dev_name_probe() - device probe for ST sensor name * @dev: driver model representation of the device. - * @match: the OF match table for the device, containing compatible strings - * but also a .data field with the corresponding internal kernel name - * used by this sensor. * @name: device name buffer reference. * @len: device name buffer length. * - * In effect this function matches a compatible string to an internal kernel + * In effect this function matches an ID to an internal kernel * name for a certain sensor device, so that the rest of the autodetection can * rely on that name from this point on. I2C/SPI devices will be renamed * to match the internal kernel convention. */ -void st_sensors_of_name_probe(struct device *dev, - const struct of_device_id *match, - char *name, int len) +void st_sensors_dev_name_probe(struct device *dev, char *name, int len) { - const struct of_device_id *of_id; + const void *match; - of_id = of_match_device(match, dev); - if (!of_id || !of_id->data) + match = device_get_match_data(dev); + if (!match) return; - /* The name from the OF match takes precedence if present */ - strlcpy(name, of_id->data, len); + /* The name from the match takes precedence if present */ + strlcpy(name, match, len); } -EXPORT_SYMBOL(st_sensors_of_name_probe); -#else -static struct st_sensors_platform_data *st_sensors_of_probe(struct device *dev, - struct st_sensors_platform_data *defdata) -{ - return NULL; -} -#endif +EXPORT_SYMBOL(st_sensors_dev_name_probe); int st_sensors_init_sensor(struct iio_dev *indio_dev, struct st_sensors_platform_data *pdata) diff --git a/drivers/iio/common/st_sensors/st_sensors_i2c.c b/drivers/iio/common/st_sensors/st_sensors_i2c.c index aa89d54a7c59..286830fb5d35 100644 --- a/drivers/iio/common/st_sensors/st_sensors_i2c.c +++ b/drivers/iio/common/st_sensors/st_sensors_i2c.c @@ -11,8 +11,6 @@ #include #include #include -#include -#include #include #include @@ -68,25 +66,6 @@ int st_sensors_i2c_configure(struct iio_dev *indio_dev, } EXPORT_SYMBOL(st_sensors_i2c_configure); -#ifdef CONFIG_ACPI -int st_sensors_match_acpi_device(struct device *dev) -{ - const struct acpi_device_id *acpi_id; - kernel_ulong_t driver_data = 0; - - if (ACPI_HANDLE(dev)) { - acpi_id = acpi_match_device(dev->driver->acpi_match_table, dev); - if (!acpi_id) { - dev_err(dev, "No driver data\n"); - return -EINVAL; - } - driver_data = acpi_id->driver_data; - } - return driver_data; -} -EXPORT_SYMBOL(st_sensors_match_acpi_device); -#endif - MODULE_AUTHOR("Denis Ciocca "); MODULE_DESCRIPTION("STMicroelectronics ST-sensors i2c driver"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/iio/gyro/st_gyro_i2c.c b/drivers/iio/gyro/st_gyro_i2c.c index 05a1a0874bd5..bc0010835ac0 100644 --- a/drivers/iio/gyro/st_gyro_i2c.c +++ b/drivers/iio/gyro/st_gyro_i2c.c @@ -70,8 +70,7 @@ static int st_gyro_i2c_probe(struct i2c_client *client, struct iio_dev *indio_dev; int err; - st_sensors_of_name_probe(&client->dev, st_gyro_of_match, - client->name, sizeof(client->name)); + st_sensors_dev_name_probe(&client->dev, client->name, sizeof(client->name)); settings = st_gyro_get_settings(client->name); if (!settings) { diff --git a/drivers/iio/gyro/st_gyro_spi.c b/drivers/iio/gyro/st_gyro_spi.c index b5c624251231..07224d5bf299 100644 --- a/drivers/iio/gyro/st_gyro_spi.c +++ b/drivers/iio/gyro/st_gyro_spi.c @@ -74,8 +74,7 @@ static int st_gyro_spi_probe(struct spi_device *spi) struct iio_dev *indio_dev; int err; - st_sensors_of_name_probe(&spi->dev, st_gyro_of_match, - spi->modalias, sizeof(spi->modalias)); + st_sensors_dev_name_probe(&spi->dev, spi->modalias, sizeof(spi->modalias)); settings = st_gyro_get_settings(spi->modalias); if (!settings) { diff --git a/drivers/iio/magnetometer/st_magn_i2c.c b/drivers/iio/magnetometer/st_magn_i2c.c index fdba480a12be..bf63777bbc6e 100644 --- a/drivers/iio/magnetometer/st_magn_i2c.c +++ b/drivers/iio/magnetometer/st_magn_i2c.c @@ -62,8 +62,7 @@ static int st_magn_i2c_probe(struct i2c_client *client, struct iio_dev *indio_dev; int err; - st_sensors_of_name_probe(&client->dev, st_magn_of_match, - client->name, sizeof(client->name)); + st_sensors_dev_name_probe(&client->dev, client->name, sizeof(client->name)); settings = st_magn_get_settings(client->name); if (!settings) { diff --git a/drivers/iio/magnetometer/st_magn_spi.c b/drivers/iio/magnetometer/st_magn_spi.c index fbf909bde841..78f846fc120e 100644 --- a/drivers/iio/magnetometer/st_magn_spi.c +++ b/drivers/iio/magnetometer/st_magn_spi.c @@ -56,8 +56,7 @@ static int st_magn_spi_probe(struct spi_device *spi) struct iio_dev *indio_dev; int err; - st_sensors_of_name_probe(&spi->dev, st_magn_of_match, - spi->modalias, sizeof(spi->modalias)); + st_sensors_dev_name_probe(&spi->dev, spi->modalias, sizeof(spi->modalias)); settings = st_magn_get_settings(spi->modalias); if (!settings) { diff --git a/drivers/iio/pressure/st_pressure_i2c.c b/drivers/iio/pressure/st_pressure_i2c.c index 6203bc9d5c2d..dd1f515ca1f1 100644 --- a/drivers/iio/pressure/st_pressure_i2c.c +++ b/drivers/iio/pressure/st_pressure_i2c.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include @@ -83,18 +82,7 @@ static int st_press_i2c_probe(struct i2c_client *client, struct iio_dev *indio_dev; int ret; - if (client->dev.of_node) { - st_sensors_of_name_probe(&client->dev, st_press_of_match, - client->name, sizeof(client->name)); - } else if (ACPI_HANDLE(&client->dev)) { - ret = st_sensors_match_acpi_device(&client->dev); - if ((ret < 0) || (ret >= ST_PRESS_MAX)) - return -ENODEV; - - strlcpy(client->name, st_press_id_table[ret].name, - sizeof(client->name)); - } else if (!id) - return -ENODEV; + st_sensors_dev_name_probe(&client->dev, client->name, sizeof(client->name)); settings = st_press_get_settings(client->name); if (!settings) { diff --git a/drivers/iio/pressure/st_pressure_spi.c b/drivers/iio/pressure/st_pressure_spi.c index 7c8b70221e70..dd31241bf4b4 100644 --- a/drivers/iio/pressure/st_pressure_spi.c +++ b/drivers/iio/pressure/st_pressure_spi.c @@ -66,8 +66,7 @@ static int st_press_spi_probe(struct spi_device *spi) struct iio_dev *indio_dev; int err; - st_sensors_of_name_probe(&spi->dev, st_press_of_match, - spi->modalias, sizeof(spi->modalias)); + st_sensors_dev_name_probe(&spi->dev, spi->modalias, sizeof(spi->modalias)); settings = st_press_get_settings(spi->modalias); if (!settings) { diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h index 686be532f4cb..33e939977444 100644 --- a/include/linux/iio/common/st_sensors.h +++ b/include/linux/iio/common/st_sensors.h @@ -315,16 +315,6 @@ ssize_t st_sensors_sysfs_sampling_frequency_avail(struct device *dev, ssize_t st_sensors_sysfs_scale_avail(struct device *dev, struct device_attribute *attr, char *buf); -#ifdef CONFIG_OF -void st_sensors_of_name_probe(struct device *dev, - const struct of_device_id *match, - char *name, int len); -#else -static inline void st_sensors_of_name_probe(struct device *dev, - const struct of_device_id *match, - char *name, int len) -{ -} -#endif +void st_sensors_dev_name_probe(struct device *dev, char *name, int len); #endif /* ST_SENSORS_H */ diff --git a/include/linux/iio/common/st_sensors_i2c.h b/include/linux/iio/common/st_sensors_i2c.h index 01e424e2af4f..5f15cf01036c 100644 --- a/include/linux/iio/common/st_sensors_i2c.h +++ b/include/linux/iio/common/st_sensors_i2c.h @@ -12,18 +12,8 @@ #include #include -#include int st_sensors_i2c_configure(struct iio_dev *indio_dev, struct i2c_client *client); -#ifdef CONFIG_ACPI -int st_sensors_match_acpi_device(struct device *dev); -#else -static inline int st_sensors_match_acpi_device(struct device *dev) -{ - return -ENODEV; -} -#endif - #endif /* ST_SENSORS_I2C_H */ From patchwork Mon Dec 16 17:38:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11294879 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 792AA17F0 for ; Mon, 16 Dec 2019 17:39:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4C42B20717 for ; Mon, 16 Dec 2019 17:39:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726227AbfLPRjB (ORCPT ); Mon, 16 Dec 2019 12:39:01 -0500 Received: from mga11.intel.com ([192.55.52.93]:14035 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726426AbfLPRjB (ORCPT ); Mon, 16 Dec 2019 12:39:01 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Dec 2019 09:39:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,322,1571727600"; d="scan'208";a="240111559" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga004.fm.intel.com with ESMTP; 16 Dec 2019 09:38:59 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 413DC685; Mon, 16 Dec 2019 19:38:55 +0200 (EET) From: Andy Shevchenko To: Jonathan Cameron , linux-iio@vger.kernel.org, Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler Cc: Andy Shevchenko Subject: [PATCH v1 9/9] iio: st_sensors: Make use of device properties Date: Mon, 16 Dec 2019 19:38:53 +0200 Message-Id: <20191216173853.75797-9-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191216173853.75797-1-andriy.shevchenko@linux.intel.com> References: <20191216173853.75797-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Device property API allows to gather device resources from different sources, such as ACPI. Convert the drivers to unleash the power of device property API. Signed-off-by: Andy Shevchenko --- drivers/iio/accel/st_accel_i2c.c | 6 +----- drivers/iio/accel/st_accel_spi.c | 6 +----- .../iio/common/st_sensors/st_sensors_core.c | 21 +++++-------------- .../iio/common/st_sensors/st_sensors_spi.c | 12 ++++++----- drivers/iio/gyro/st_gyro_i2c.c | 6 +----- drivers/iio/gyro/st_gyro_spi.c | 6 +----- drivers/iio/magnetometer/st_magn_i2c.c | 6 +----- drivers/iio/magnetometer/st_magn_spi.c | 6 +----- drivers/iio/pressure/st_pressure_i2c.c | 6 +----- drivers/iio/pressure/st_pressure_spi.c | 6 +----- 10 files changed, 20 insertions(+), 61 deletions(-) diff --git a/drivers/iio/accel/st_accel_i2c.c b/drivers/iio/accel/st_accel_i2c.c index 0f4aef5448e7..633955d764cc 100644 --- a/drivers/iio/accel/st_accel_i2c.c +++ b/drivers/iio/accel/st_accel_i2c.c @@ -18,7 +18,6 @@ #include #include "st_accel.h" -#ifdef CONFIG_OF static const struct of_device_id st_accel_of_match[] = { { /* An older compatible */ @@ -108,9 +107,6 @@ static const struct of_device_id st_accel_of_match[] = { {}, }; MODULE_DEVICE_TABLE(of, st_accel_of_match); -#else -#define st_accel_of_match NULL -#endif #ifdef CONFIG_ACPI static const struct acpi_device_id st_accel_acpi_match[] = { @@ -193,7 +189,7 @@ static int st_accel_i2c_remove(struct i2c_client *client) static struct i2c_driver st_accel_driver = { .driver = { .name = "st-accel-i2c", - .of_match_table = of_match_ptr(st_accel_of_match), + .of_match_table = st_accel_of_match, .acpi_match_table = ACPI_PTR(st_accel_acpi_match), }, .probe_new = st_accel_i2c_probe, diff --git a/drivers/iio/accel/st_accel_spi.c b/drivers/iio/accel/st_accel_spi.c index 3e25268638e2..568ff1bae0ee 100644 --- a/drivers/iio/accel/st_accel_spi.c +++ b/drivers/iio/accel/st_accel_spi.c @@ -17,7 +17,6 @@ #include #include "st_accel.h" -#ifdef CONFIG_OF /* * For new single-chip sensors use as compatible string. * For old single-chip devices keep -accel to maintain @@ -96,9 +95,6 @@ static const struct of_device_id st_accel_of_match[] = { {} }; MODULE_DEVICE_TABLE(of, st_accel_of_match); -#else -#define st_accel_of_match NULL -#endif static int st_accel_spi_probe(struct spi_device *spi) { @@ -165,7 +161,7 @@ MODULE_DEVICE_TABLE(spi, st_accel_id_table); static struct spi_driver st_accel_driver = { .driver = { .name = "st-accel-spi", - .of_match_table = of_match_ptr(st_accel_of_match), + .of_match_table = st_accel_of_match, }, .probe = st_accel_spi_probe, .remove = st_accel_spi_remove, diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c index 42a71a50650f..e051edbc43c1 100644 --- a/drivers/iio/common/st_sensors/st_sensors_core.c +++ b/drivers/iio/common/st_sensors/st_sensors_core.c @@ -14,8 +14,6 @@ #include #include #include -#include -#include #include #include #include @@ -320,34 +318,25 @@ static int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev, return 0; } -#ifdef CONFIG_OF -static struct st_sensors_platform_data *st_sensors_of_probe(struct device *dev, +static struct st_sensors_platform_data *st_sensors_dev_probe(struct device *dev, struct st_sensors_platform_data *defdata) { struct st_sensors_platform_data *pdata; - struct device_node *np = dev->of_node; u32 val; - if (!np) + if (!dev_fwnode(dev)) return NULL; pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); - if (!of_property_read_u32(np, "st,drdy-int-pin", &val) && (val <= 2)) + if (!device_property_read_u32(dev, "st,drdy-int-pin", &val) && (val <= 2)) pdata->drdy_int_pin = (u8) val; else pdata->drdy_int_pin = defdata ? defdata->drdy_int_pin : 0; - pdata->open_drain = of_property_read_bool(np, "drive-open-drain"); + pdata->open_drain = device_property_read_bool(dev, "drive-open-drain"); return pdata; } -#else -static struct st_sensors_platform_data *st_sensors_of_probe(struct device *dev, - struct st_sensors_platform_data *defdata) -{ - return NULL; -} -#endif /** * st_sensors_dev_name_probe() - device probe for ST sensor name @@ -381,7 +370,7 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev, int err = 0; /* If OF/DT pdata exists, it will take precedence of anything else */ - of_pdata = st_sensors_of_probe(indio_dev->dev.parent, pdata); + of_pdata = st_sensors_dev_probe(indio_dev->dev.parent, pdata); if (of_pdata) pdata = of_pdata; diff --git a/drivers/iio/common/st_sensors/st_sensors_spi.c b/drivers/iio/common/st_sensors/st_sensors_spi.c index 2262f81b07c2..1275fb0eda31 100644 --- a/drivers/iio/common/st_sensors/st_sensors_spi.c +++ b/drivers/iio/common/st_sensors/st_sensors_spi.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -37,14 +38,15 @@ static const struct regmap_config st_sensors_spi_regmap_multiread_bit_config = { */ static bool st_sensors_is_spi_3_wire(struct spi_device *spi) { - struct device_node *np = spi->dev.of_node; struct st_sensors_platform_data *pdata; + struct device *dev = &spi->dev; - pdata = (struct st_sensors_platform_data *)spi->dev.platform_data; - if ((np && of_property_read_bool(np, "spi-3wire")) || - (pdata && pdata->spi_3wire)) { + if (device_property_read_bool(dev, "spi-3wire")) + return true; + + pdata = (struct st_sensors_platform_data *)dev->platform_data; + if (pdata && pdata->spi_3wire) return true; - } return false; } diff --git a/drivers/iio/gyro/st_gyro_i2c.c b/drivers/iio/gyro/st_gyro_i2c.c index bc0010835ac0..8190966e6ff0 100644 --- a/drivers/iio/gyro/st_gyro_i2c.c +++ b/drivers/iio/gyro/st_gyro_i2c.c @@ -17,7 +17,6 @@ #include #include "st_gyro.h" -#ifdef CONFIG_OF static const struct of_device_id st_gyro_of_match[] = { { .compatible = "st,l3g4200d-gyro", @@ -58,9 +57,6 @@ static const struct of_device_id st_gyro_of_match[] = { {}, }; MODULE_DEVICE_TABLE(of, st_gyro_of_match); -#else -#define st_gyro_of_match NULL -#endif static int st_gyro_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) @@ -121,7 +117,7 @@ MODULE_DEVICE_TABLE(i2c, st_gyro_id_table); static struct i2c_driver st_gyro_driver = { .driver = { .name = "st-gyro-i2c", - .of_match_table = of_match_ptr(st_gyro_of_match), + .of_match_table = st_gyro_of_match, }, .probe = st_gyro_i2c_probe, .remove = st_gyro_i2c_remove, diff --git a/drivers/iio/gyro/st_gyro_spi.c b/drivers/iio/gyro/st_gyro_spi.c index 07224d5bf299..efb862763ca3 100644 --- a/drivers/iio/gyro/st_gyro_spi.c +++ b/drivers/iio/gyro/st_gyro_spi.c @@ -17,7 +17,6 @@ #include #include "st_gyro.h" -#ifdef CONFIG_OF /* * For new single-chip sensors use as compatible string. * For old single-chip devices keep -gyro to maintain @@ -63,9 +62,6 @@ static const struct of_device_id st_gyro_of_match[] = { {}, }; MODULE_DEVICE_TABLE(of, st_gyro_of_match); -#else -#define st_gyro_of_match NULL -#endif static int st_gyro_spi_probe(struct spi_device *spi) { @@ -125,7 +121,7 @@ MODULE_DEVICE_TABLE(spi, st_gyro_id_table); static struct spi_driver st_gyro_driver = { .driver = { .name = "st-gyro-spi", - .of_match_table = of_match_ptr(st_gyro_of_match), + .of_match_table = st_gyro_of_match, }, .probe = st_gyro_spi_probe, .remove = st_gyro_spi_remove, diff --git a/drivers/iio/magnetometer/st_magn_i2c.c b/drivers/iio/magnetometer/st_magn_i2c.c index bf63777bbc6e..c6bb4ce77594 100644 --- a/drivers/iio/magnetometer/st_magn_i2c.c +++ b/drivers/iio/magnetometer/st_magn_i2c.c @@ -17,7 +17,6 @@ #include #include "st_magn.h" -#ifdef CONFIG_OF static const struct of_device_id st_magn_of_match[] = { { .compatible = "st,lsm303dlh-magn", @@ -50,9 +49,6 @@ static const struct of_device_id st_magn_of_match[] = { {}, }; MODULE_DEVICE_TABLE(of, st_magn_of_match); -#else -#define st_magn_of_match NULL -#endif static int st_magn_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) @@ -112,7 +108,7 @@ MODULE_DEVICE_TABLE(i2c, st_magn_id_table); static struct i2c_driver st_magn_driver = { .driver = { .name = "st-magn-i2c", - .of_match_table = of_match_ptr(st_magn_of_match), + .of_match_table = st_magn_of_match, }, .probe = st_magn_i2c_probe, .remove = st_magn_i2c_remove, diff --git a/drivers/iio/magnetometer/st_magn_spi.c b/drivers/iio/magnetometer/st_magn_spi.c index 78f846fc120e..3d08d74c367d 100644 --- a/drivers/iio/magnetometer/st_magn_spi.c +++ b/drivers/iio/magnetometer/st_magn_spi.c @@ -17,7 +17,6 @@ #include #include "st_magn.h" -#ifdef CONFIG_OF /* * For new single-chip sensors use as compatible string. * For old single-chip devices keep -magn to maintain @@ -45,9 +44,6 @@ static const struct of_device_id st_magn_of_match[] = { {} }; MODULE_DEVICE_TABLE(of, st_magn_of_match); -#else -#define st_magn_of_match NULL -#endif static int st_magn_spi_probe(struct spi_device *spi) { @@ -103,7 +99,7 @@ MODULE_DEVICE_TABLE(spi, st_magn_id_table); static struct spi_driver st_magn_driver = { .driver = { .name = "st-magn-spi", - .of_match_table = of_match_ptr(st_magn_of_match), + .of_match_table = st_magn_of_match, }, .probe = st_magn_spi_probe, .remove = st_magn_spi_remove, diff --git a/drivers/iio/pressure/st_pressure_i2c.c b/drivers/iio/pressure/st_pressure_i2c.c index dd1f515ca1f1..09c6903f99b8 100644 --- a/drivers/iio/pressure/st_pressure_i2c.c +++ b/drivers/iio/pressure/st_pressure_i2c.c @@ -17,7 +17,6 @@ #include #include "st_pressure.h" -#ifdef CONFIG_OF static const struct of_device_id st_press_of_match[] = { { .compatible = "st,lps001wp-press", @@ -50,9 +49,6 @@ static const struct of_device_id st_press_of_match[] = { {}, }; MODULE_DEVICE_TABLE(of, st_press_of_match); -#else -#define st_press_of_match NULL -#endif #ifdef CONFIG_ACPI static const struct acpi_device_id st_press_acpi_match[] = { @@ -119,7 +115,7 @@ static int st_press_i2c_remove(struct i2c_client *client) static struct i2c_driver st_press_driver = { .driver = { .name = "st-press-i2c", - .of_match_table = of_match_ptr(st_press_of_match), + .of_match_table = st_press_of_match, .acpi_match_table = ACPI_PTR(st_press_acpi_match), }, .probe = st_press_i2c_probe, diff --git a/drivers/iio/pressure/st_pressure_spi.c b/drivers/iio/pressure/st_pressure_spi.c index dd31241bf4b4..b5ee3ec2764f 100644 --- a/drivers/iio/pressure/st_pressure_spi.c +++ b/drivers/iio/pressure/st_pressure_spi.c @@ -17,7 +17,6 @@ #include #include "st_pressure.h" -#ifdef CONFIG_OF /* * For new single-chip sensors use as compatible string. * For old single-chip devices keep -press to maintain @@ -55,9 +54,6 @@ static const struct of_device_id st_press_of_match[] = { {}, }; MODULE_DEVICE_TABLE(of, st_press_of_match); -#else -#define st_press_of_match NULL -#endif static int st_press_spi_probe(struct spi_device *spi) { @@ -115,7 +111,7 @@ MODULE_DEVICE_TABLE(spi, st_press_id_table); static struct spi_driver st_press_driver = { .driver = { .name = "st-press-spi", - .of_match_table = of_match_ptr(st_press_of_match), + .of_match_table = st_press_of_match, }, .probe = st_press_spi_probe, .remove = st_press_spi_remove,