From patchwork Tue Feb 22 09:00:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12754664 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 C1C25C433FE for ; Tue, 22 Feb 2022 08:59:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229997AbiBVJAW (ORCPT ); Tue, 22 Feb 2022 04:00:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229934AbiBVJAV (ORCPT ); Tue, 22 Feb 2022 04:00:21 -0500 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6AE713D568; Tue, 22 Feb 2022 00:59:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645520396; x=1677056396; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=tuqRcRyw9c0tVwEZaLya9J85oZG+2E1rNuWZVStKrGE=; b=hiiJ/7JcjRpihaK8yeWVicqHlkgolk8dtmJqd9ZR9o3sdY/KiG31PEfZ Z+E6y3BrDIAfrSXPJdENKPF0hzTPr99A0TXF1WZxTJYIUvdFfikS2hmS6 RiYmHQqAxsh3evpy4RwRc+ZoT8+rZplUQ992KVFBjCpkM81KHHF7grEGi HBC0uvlZ9pfQoHB0fdRlmLILwZJagLIgi4c4Y0gOcqFjR/vrZrb3Z0jKg dPv20mnsq6/9mIEolbYQmiivlQXk/xJ3eS66w0EVIkFvy1Ay80Kd0es/8 YwtCS6M3EUEfE7WmdW43ugTWTBw9MiwsNfTGA0T1wiNR3kUjY48D4Veef A==; X-IronPort-AV: E=McAfee;i="6200,9189,10265"; a="251829059" X-IronPort-AV: E=Sophos;i="5.88,387,1635231600"; d="scan'208";a="251829059" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2022 00:59:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,387,1635231600"; d="scan'208";a="532145469" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga007.jf.intel.com with ESMTP; 22 Feb 2022 00:59:54 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 97A93142; Tue, 22 Feb 2022 11:00:10 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Kai-Heng Feng Subject: [PATCH v2 1/8] iio: accel: adxl345: Convert to use dev_err_probe() Date: Tue, 22 Feb 2022 11:00:02 +0200 Message-Id: <20220222090009.2060-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org It's fine to call dev_err_probe() in ->probe() when error code is known. Convert the driver to use dev_err_probe(). Signed-off-by: Andy Shevchenko Tested-by: Kai-Heng Feng --- v2: fixed typo (LKP), shorten one line to satisfy checkpatch drivers/iio/accel/adxl345_core.c | 26 +++++++++----------------- drivers/iio/accel/adxl345_i2c.c | 7 ++----- drivers/iio/accel/adxl345_spi.c | 15 +++++---------- 3 files changed, 16 insertions(+), 32 deletions(-) diff --git a/drivers/iio/accel/adxl345_core.c b/drivers/iio/accel/adxl345_core.c index ef2240e356e0..078e1029e49d 100644 --- a/drivers/iio/accel/adxl345_core.c +++ b/drivers/iio/accel/adxl345_core.c @@ -222,16 +222,12 @@ int adxl345_core_probe(struct device *dev, struct regmap *regmap, int ret; ret = regmap_read(regmap, ADXL345_REG_DEVID, ®val); - if (ret < 0) { - dev_err(dev, "Error reading device ID: %d\n", ret); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, "Error reading device ID\n"); - if (regval != ADXL345_DEVID) { - dev_err(dev, "Invalid device ID: %x, expected %x\n", - regval, ADXL345_DEVID); - return -ENODEV; - } + if (regval != ADXL345_DEVID) + return dev_err_probe(dev, -ENODEV, "Invalid device ID: %x, expected %x\n", + regval, ADXL345_DEVID); indio_dev = devm_iio_device_alloc(dev, sizeof(*data)); if (!indio_dev) @@ -245,10 +241,8 @@ int adxl345_core_probe(struct device *dev, struct regmap *regmap, ret = regmap_write(data->regmap, ADXL345_REG_DATA_FORMAT, data->data_range); - if (ret < 0) { - dev_err(dev, "Failed to set data range: %d\n", ret); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, "Failed to set data range\n"); indio_dev->name = name; indio_dev->info = &adxl345_info; @@ -259,10 +253,8 @@ int adxl345_core_probe(struct device *dev, struct regmap *regmap, /* Enable measurement mode */ ret = regmap_write(data->regmap, ADXL345_REG_POWER_CTL, ADXL345_POWER_CTL_MEASURE); - if (ret < 0) { - dev_err(dev, "Failed to enable measurement mode: %d\n", ret); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, "Failed to enable measurement mode\n"); ret = devm_add_action_or_reset(dev, adxl345_powerdown, data->regmap); if (ret < 0) diff --git a/drivers/iio/accel/adxl345_i2c.c b/drivers/iio/accel/adxl345_i2c.c index 7bc8324c4f07..e3205dce91b8 100644 --- a/drivers/iio/accel/adxl345_i2c.c +++ b/drivers/iio/accel/adxl345_i2c.c @@ -28,11 +28,8 @@ static int adxl345_i2c_probe(struct i2c_client *client, return -ENODEV; regmap = devm_regmap_init_i2c(client, &adxl345_i2c_regmap_config); - if (IS_ERR(regmap)) { - dev_err(&client->dev, "Error initializing i2c regmap: %ld\n", - PTR_ERR(regmap)); - return PTR_ERR(regmap); - } + if (IS_ERR(regmap)) + return dev_err_probe(&client->dev, PTR_ERR(regmap), "Error initializing regmap\n"); return adxl345_core_probe(&client->dev, regmap, id->driver_data, id->name); diff --git a/drivers/iio/accel/adxl345_spi.c b/drivers/iio/accel/adxl345_spi.c index c752562c5d3b..9223302fdd46 100644 --- a/drivers/iio/accel/adxl345_spi.c +++ b/drivers/iio/accel/adxl345_spi.c @@ -26,18 +26,13 @@ static int adxl345_spi_probe(struct spi_device *spi) struct regmap *regmap; /* Bail out if max_speed_hz exceeds 5 MHz */ - if (spi->max_speed_hz > ADXL345_MAX_SPI_FREQ_HZ) { - dev_err(&spi->dev, "SPI CLK, %d Hz exceeds 5 MHz\n", - spi->max_speed_hz); - return -EINVAL; - } + if (spi->max_speed_hz > ADXL345_MAX_SPI_FREQ_HZ) + return dev_err_probe(&spi->dev, -EINVAL, "SPI CLK, %d Hz exceeds 5 MHz\n", + spi->max_speed_hz); regmap = devm_regmap_init_spi(spi, &adxl345_spi_regmap_config); - if (IS_ERR(regmap)) { - dev_err(&spi->dev, "Error initializing spi regmap: %ld\n", - PTR_ERR(regmap)); - return PTR_ERR(regmap); - } + if (IS_ERR(regmap)) + return dev_err_probe(&spi->dev, PTR_ERR(regmap), "Error initializing regmap\n"); return adxl345_core_probe(&spi->dev, regmap, id->driver_data, id->name); } From patchwork Tue Feb 22 09:00:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12754666 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 82B6EC43219 for ; Tue, 22 Feb 2022 09:00:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230023AbiBVJAX (ORCPT ); Tue, 22 Feb 2022 04:00:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229965AbiBVJAV (ORCPT ); Tue, 22 Feb 2022 04:00:21 -0500 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C395213D571; Tue, 22 Feb 2022 00:59:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645520396; x=1677056396; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=o4envaYLqs+z52hQ8wGkddicuVsNghNQMBwQHZvdqsc=; b=kirNRBmpUF936yYvRy8At21xiu036F8hgeKj2aFRnnbbZmJFvJWFiUB9 /lvtT32dhSM1IEvk7OdvNyxFzbJsDUCsE4ZjeYscWJcqWmz/f1HEeg1Pb pyIbcfpzU6in4hDcp/nJnVFbMP9wzppChOeaJANBpFR/TBFBpvdYRgOhH pRyEnSssH85mAGiWBJhe68KY2GcN/eTx+kS694Lhc46Q+RVvwD9qri5PH 32pjAsJs4RckPL/7JAZzhE71GUIJg2qZUYvAGMEZmW9BBY9zrzoWON4Ii AsiSBQfCAcEkDs5+R0SdZmAl2WJuLoOXzcxklbmW2u2EfUO7sKK5buHk3 A==; X-IronPort-AV: E=McAfee;i="6200,9189,10265"; a="314907081" X-IronPort-AV: E=Sophos;i="5.88,387,1635231600"; d="scan'208";a="314907081" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2022 00:59:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,387,1635231600"; d="scan'208";a="778977598" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga005.fm.intel.com with ESMTP; 22 Feb 2022 00:59:54 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 9F1D412C; Tue, 22 Feb 2022 11:00:10 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Kai-Heng Feng Subject: [PATCH v2 2/8] iio: accel: adxl345: Set driver_data for OF enumeration Date: Tue, 22 Feb 2022 11:00:03 +0200 Message-Id: <20220222090009.2060-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220222090009.2060-1-andriy.shevchenko@linux.intel.com> References: <20220222090009.2060-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org In order to enable this driver on mode platforms, assign driver_data field in the OF device ID table. While at it, make sure that device type is not 0 which may be wrongly interpreted by device property APIs in the future. Signed-off-by: Andy Shevchenko --- v2: used proper casting for the supplied data (LKP) drivers/iio/accel/adxl345.h | 4 ++-- drivers/iio/accel/adxl345_i2c.c | 4 ++-- drivers/iio/accel/adxl345_spi.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/iio/accel/adxl345.h b/drivers/iio/accel/adxl345.h index af0fdd02c4f2..5a68d4dac717 100644 --- a/drivers/iio/accel/adxl345.h +++ b/drivers/iio/accel/adxl345.h @@ -9,8 +9,8 @@ #define _ADXL345_H_ enum adxl345_device_type { - ADXL345, - ADXL375, + ADXL345 = 1, + ADXL375 = 2, }; int adxl345_core_probe(struct device *dev, struct regmap *regmap, diff --git a/drivers/iio/accel/adxl345_i2c.c b/drivers/iio/accel/adxl345_i2c.c index e3205dce91b8..4c6efe2eefc1 100644 --- a/drivers/iio/accel/adxl345_i2c.c +++ b/drivers/iio/accel/adxl345_i2c.c @@ -44,8 +44,8 @@ static const struct i2c_device_id adxl345_i2c_id[] = { MODULE_DEVICE_TABLE(i2c, adxl345_i2c_id); static const struct of_device_id adxl345_of_match[] = { - { .compatible = "adi,adxl345" }, - { .compatible = "adi,adxl375" }, + { .compatible = "adi,adxl345", .data = (const void *)ADXL345 }, + { .compatible = "adi,adxl375", .data = (const void *)ADXL375 }, { }, }; diff --git a/drivers/iio/accel/adxl345_spi.c b/drivers/iio/accel/adxl345_spi.c index 9223302fdd46..72550132b1bb 100644 --- a/drivers/iio/accel/adxl345_spi.c +++ b/drivers/iio/accel/adxl345_spi.c @@ -46,8 +46,8 @@ static const struct spi_device_id adxl345_spi_id[] = { MODULE_DEVICE_TABLE(spi, adxl345_spi_id); static const struct of_device_id adxl345_of_match[] = { - { .compatible = "adi,adxl345" }, - { .compatible = "adi,adxl375" }, + { .compatible = "adi,adxl345", .data = (const void *)ADXL345 }, + { .compatible = "adi,adxl375", .data = (const void *)ADXL375 }, { }, }; From patchwork Tue Feb 22 09:00:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12754665 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 72BDCC4332F for ; Tue, 22 Feb 2022 09:00:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230035AbiBVJAX (ORCPT ); Tue, 22 Feb 2022 04:00:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230028AbiBVJAW (ORCPT ); Tue, 22 Feb 2022 04:00:22 -0500 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47F9813D57C; Tue, 22 Feb 2022 00:59:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645520397; x=1677056397; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VHUSriWSk8GyJqXL7DN4Focv9W+osyWzJ9YdqQtFgTA=; b=HS8vmaj2yeiJ6XzEZHhB7Qit0BpQjYOx2YL+85EwvxQWNR6dQn4s4z0I Nlw05gzA2B3LuJ/xgXgCFV/pekMrELeYY0usnJIjPtexngUZcHLbyYKwq QEAIcY++T7pRjwWdlouyow5c9RXU5L6PsscchWW2JO9VDFo2lhachnwf5 Jl6pqZGLbnb37nTcnQKN353wrIS/+pzUQq6pJy3eh23MH6FZpycvYEJF0 k/rXTQyaqELJtAuFS1S/+Q6mZtdnPIjMVfox8AP1K7AFsCSWDEWgWf8fs LSSlbTEAXjFOMt1YLH0YrrUKOZ1/ZAdV87+KSGYNBWZllXUO8/1YDyeT3 Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10265"; a="251829061" X-IronPort-AV: E=Sophos;i="5.88,387,1635231600"; d="scan'208";a="251829061" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2022 00:59:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,387,1635231600"; d="scan'208";a="507905724" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga006.jf.intel.com with ESMTP; 22 Feb 2022 00:59:54 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id B23591ED; Tue, 22 Feb 2022 11:00:10 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Kai-Heng Feng Subject: [PATCH v2 3/8] iio: accel: adxl345: Get rid of name parameter in adxl345_core_probe() Date: Tue, 22 Feb 2022 11:00:04 +0200 Message-Id: <20220222090009.2060-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220222090009.2060-1-andriy.shevchenko@linux.intel.com> References: <20220222090009.2060-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org As a preparation to switch to use device properties, get rid of name parameter in adxl345_core_probe(). Instead, choose it based on the type. Signed-off-by: Andy Shevchenko --- v2: no changes drivers/iio/accel/adxl345.h | 3 +-- drivers/iio/accel/adxl345_core.c | 15 +++++++++++++-- drivers/iio/accel/adxl345_i2c.c | 3 +-- drivers/iio/accel/adxl345_spi.c | 2 +- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/iio/accel/adxl345.h b/drivers/iio/accel/adxl345.h index 5a68d4dac717..9b0d4f487c43 100644 --- a/drivers/iio/accel/adxl345.h +++ b/drivers/iio/accel/adxl345.h @@ -13,7 +13,6 @@ enum adxl345_device_type { ADXL375 = 2, }; -int adxl345_core_probe(struct device *dev, struct regmap *regmap, - enum adxl345_device_type type, const char *name); +int adxl345_core_probe(struct device *dev, struct regmap *regmap, enum adxl345_device_type type); #endif /* _ADXL345_H_ */ diff --git a/drivers/iio/accel/adxl345_core.c b/drivers/iio/accel/adxl345_core.c index 078e1029e49d..0f34c349aa1e 100644 --- a/drivers/iio/accel/adxl345_core.c +++ b/drivers/iio/accel/adxl345_core.c @@ -213,14 +213,25 @@ static void adxl345_powerdown(void *regmap) regmap_write(regmap, ADXL345_REG_POWER_CTL, ADXL345_POWER_CTL_STANDBY); } -int adxl345_core_probe(struct device *dev, struct regmap *regmap, - enum adxl345_device_type type, const char *name) +int adxl345_core_probe(struct device *dev, struct regmap *regmap, enum adxl345_device_type type) { struct adxl345_data *data; struct iio_dev *indio_dev; + const char *name; u32 regval; int ret; + switch (type) { + case ADXL345: + name = "adxl345"; + break; + case ADXL375: + name = "adxl375"; + break; + default: + return -EINVAL; + } + ret = regmap_read(regmap, ADXL345_REG_DEVID, ®val); if (ret < 0) return dev_err_probe(dev, ret, "Error reading device ID\n"); diff --git a/drivers/iio/accel/adxl345_i2c.c b/drivers/iio/accel/adxl345_i2c.c index 4c6efe2eefc1..1e42cf3a2991 100644 --- a/drivers/iio/accel/adxl345_i2c.c +++ b/drivers/iio/accel/adxl345_i2c.c @@ -31,8 +31,7 @@ static int adxl345_i2c_probe(struct i2c_client *client, if (IS_ERR(regmap)) return dev_err_probe(&client->dev, PTR_ERR(regmap), "Error initializing regmap\n"); - return adxl345_core_probe(&client->dev, regmap, id->driver_data, - id->name); + return adxl345_core_probe(&client->dev, regmap, id->driver_data); } static const struct i2c_device_id adxl345_i2c_id[] = { diff --git a/drivers/iio/accel/adxl345_spi.c b/drivers/iio/accel/adxl345_spi.c index 72550132b1bb..34b7001d519f 100644 --- a/drivers/iio/accel/adxl345_spi.c +++ b/drivers/iio/accel/adxl345_spi.c @@ -34,7 +34,7 @@ static int adxl345_spi_probe(struct spi_device *spi) if (IS_ERR(regmap)) return dev_err_probe(&spi->dev, PTR_ERR(regmap), "Error initializing regmap\n"); - return adxl345_core_probe(&spi->dev, regmap, id->driver_data, id->name); + return adxl345_core_probe(&spi->dev, regmap, id->driver_data); } static const struct spi_device_id adxl345_spi_id[] = { From patchwork Tue Feb 22 09:00:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12754667 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 D4326C433EF for ; Tue, 22 Feb 2022 09:00:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230047AbiBVJAY (ORCPT ); Tue, 22 Feb 2022 04:00:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230031AbiBVJAW (ORCPT ); Tue, 22 Feb 2022 04:00:22 -0500 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBD9713D568; Tue, 22 Feb 2022 00:59:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645520397; x=1677056397; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/LVjqrZirEsZLLpv0P9AR570c5V8rd61X/TBj3utK8o=; b=DIhW+XcrI+ixfTwonO+f2MGT+OdMv67EfCcF7r6v8tLyUXkXMvYdCp+S Wk2pO2Vm8+OqVzuzBoOSdAE+hiAyWP3kd7e2IkL6bNqBOmkdULLGg7VNc BAuZKktSgZZeIMboTIz9+YRvKyHzNHUf2Sl9xXMRRXuEN5iyJKK3lnNdA vzPw8nxqniytETHODTc2LDOXokB5pdtbj8Gw5neCDr4GMJzmbE2mZ/1zr /cZrkxW3MUNpnY+yh7lWkmp96Z+d48XB6XH4BdA4UmBXvHmpjsCuYxAo4 TGgxDFb5DRVQBxr04VZ6K3EinElWqF8gXVUH/JWuYb65gTqDsW/re/eSt g==; X-IronPort-AV: E=McAfee;i="6200,9189,10265"; a="314907084" X-IronPort-AV: E=Sophos;i="5.88,387,1635231600"; d="scan'208";a="314907084" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2022 00:59:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,387,1635231600"; d="scan'208";a="778977599" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga005.fm.intel.com with ESMTP; 22 Feb 2022 00:59:54 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id BD68F2FC; Tue, 22 Feb 2022 11:00:10 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Kai-Heng Feng Subject: [PATCH v2 4/8] iio: accel: adxl345: Make use of device properties Date: Tue, 22 Feb 2022 11:00:05 +0200 Message-Id: <20220222090009.2060-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220222090009.2060-1-andriy.shevchenko@linux.intel.com> References: <20220222090009.2060-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. Signed-off-by: Andy Shevchenko --- v2: no changes drivers/iio/accel/adxl345.h | 2 +- drivers/iio/accel/adxl345_core.c | 5 ++++- drivers/iio/accel/adxl345_i2c.c | 11 ++++------- drivers/iio/accel/adxl345_spi.c | 3 +-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/iio/accel/adxl345.h b/drivers/iio/accel/adxl345.h index 9b0d4f487c43..d7e67cb08538 100644 --- a/drivers/iio/accel/adxl345.h +++ b/drivers/iio/accel/adxl345.h @@ -13,6 +13,6 @@ enum adxl345_device_type { ADXL375 = 2, }; -int adxl345_core_probe(struct device *dev, struct regmap *regmap, enum adxl345_device_type type); +int adxl345_core_probe(struct device *dev, struct regmap *regmap); #endif /* _ADXL345_H_ */ diff --git a/drivers/iio/accel/adxl345_core.c b/drivers/iio/accel/adxl345_core.c index 0f34c349aa1e..315a408115b3 100644 --- a/drivers/iio/accel/adxl345_core.c +++ b/drivers/iio/accel/adxl345_core.c @@ -8,6 +8,7 @@ */ #include +#include #include #include @@ -213,14 +214,16 @@ static void adxl345_powerdown(void *regmap) regmap_write(regmap, ADXL345_REG_POWER_CTL, ADXL345_POWER_CTL_STANDBY); } -int adxl345_core_probe(struct device *dev, struct regmap *regmap, enum adxl345_device_type type) +int adxl345_core_probe(struct device *dev, struct regmap *regmap) { + enum adxl345_device_type type; struct adxl345_data *data; struct iio_dev *indio_dev; const char *name; u32 regval; int ret; + type = (uintptr_t)device_get_match_data(dev); switch (type) { case ADXL345: name = "adxl345"; diff --git a/drivers/iio/accel/adxl345_i2c.c b/drivers/iio/accel/adxl345_i2c.c index 1e42cf3a2991..861d8477d799 100644 --- a/drivers/iio/accel/adxl345_i2c.c +++ b/drivers/iio/accel/adxl345_i2c.c @@ -19,19 +19,16 @@ static const struct regmap_config adxl345_i2c_regmap_config = { .val_bits = 8, }; -static int adxl345_i2c_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int adxl345_i2c_probe(struct i2c_client *client) { + enum adxl345_device_type type; struct regmap *regmap; - if (!id) - return -ENODEV; - regmap = devm_regmap_init_i2c(client, &adxl345_i2c_regmap_config); if (IS_ERR(regmap)) return dev_err_probe(&client->dev, PTR_ERR(regmap), "Error initializing regmap\n"); - return adxl345_core_probe(&client->dev, regmap, id->driver_data); + return adxl345_core_probe(&client->dev, regmap); } static const struct i2c_device_id adxl345_i2c_id[] = { @@ -55,7 +52,7 @@ static struct i2c_driver adxl345_i2c_driver = { .name = "adxl345_i2c", .of_match_table = adxl345_of_match, }, - .probe = adxl345_i2c_probe, + .probe_new = adxl345_i2c_probe, .id_table = adxl345_i2c_id, }; diff --git a/drivers/iio/accel/adxl345_spi.c b/drivers/iio/accel/adxl345_spi.c index 34b7001d519f..ee4c50c8a95b 100644 --- a/drivers/iio/accel/adxl345_spi.c +++ b/drivers/iio/accel/adxl345_spi.c @@ -22,7 +22,6 @@ static const struct regmap_config adxl345_spi_regmap_config = { static int adxl345_spi_probe(struct spi_device *spi) { - const struct spi_device_id *id = spi_get_device_id(spi); struct regmap *regmap; /* Bail out if max_speed_hz exceeds 5 MHz */ @@ -34,7 +33,7 @@ static int adxl345_spi_probe(struct spi_device *spi) if (IS_ERR(regmap)) return dev_err_probe(&spi->dev, PTR_ERR(regmap), "Error initializing regmap\n"); - return adxl345_core_probe(&spi->dev, regmap, id->driver_data); + return adxl345_core_probe(&spi->dev, regmap); } static const struct spi_device_id adxl345_spi_id[] = { From patchwork Tue Feb 22 09:00:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12754663 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 A273EC433EF for ; Tue, 22 Feb 2022 08:59:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230029AbiBVJAW (ORCPT ); Tue, 22 Feb 2022 04:00:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229944AbiBVJAV (ORCPT ); Tue, 22 Feb 2022 04:00:21 -0500 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A876B13D569; Tue, 22 Feb 2022 00:59:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645520396; x=1677056396; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/CoOJYrIQXjl83nUCkZjGK7NC6sCc0jBYnDOtkCGkic=; b=fPYPeQjWczrGB+Yh9mR8PKa6V/WUH9N7/UZpOyWGevSARhvvDvWyJn5K 8zBmk/1k/dw5qYgC3wxCXzISJtliyFoLHniqbG88Xdk8+5YZZhgYRP5Nz 4AwTre8KOLMnrURTfluurrc9I9a+RABLN5fEDgXH5Ks3Xn9GOBOIaFvW8 IN5+TJayf++Xqhy66WzHCbm0iZujprEOU+8XDdpZtC/T+3Xu7MSOKy2qd 2g9LOVvH7TG3H664cz1qf/4Hw6oTvHLSo1S49BI6axgkzksuKms8mOiAo dI03tTTFNfa43h8lQaoq9fd+TGFgxY9iUchG6Bfw5BlDxwugZWG7WTicx Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10265"; a="338076726" X-IronPort-AV: E=Sophos;i="5.88,387,1635231600"; d="scan'208";a="338076726" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2022 00:59:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,387,1635231600"; d="scan'208";a="591229128" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 22 Feb 2022 00:59:54 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id C88B340D; Tue, 22 Feb 2022 11:00:10 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Kai-Heng Feng , Andy Shevchenko Subject: [PATCH v2 5/8] iio: accel: adxl345: Add ACPI HID table Date: Tue, 22 Feb 2022 11:00:06 +0200 Message-Id: <20220222090009.2060-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220222090009.2060-1-andriy.shevchenko@linux.intel.com> References: <20220222090009.2060-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Kai-Heng Feng x86 boards may use ACPI HID "ADS0345" for adxl345 device. Analog replied: "ADS034X is not a valid PNP ID. ADS0345 would be. I'm not aware that this ID is already taken. Feel free to submit a mainline Linux input mailing list patch." So add an ACPI match table for that accordingly. Since ACPI device may not match to any I2C ID, use the name and type directly from ACPI ID table in absence of I2C ID. Suggested-by: Andy Shevchenko Signed-off-by: Kai-Heng Feng Signed-off-by: Andy Shevchenko --- v2: no changes drivers/iio/accel/adxl345_i2c.c | 7 +++++++ drivers/iio/accel/adxl345_spi.c | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/drivers/iio/accel/adxl345_i2c.c b/drivers/iio/accel/adxl345_i2c.c index 861d8477d799..11ecff0e0405 100644 --- a/drivers/iio/accel/adxl345_i2c.c +++ b/drivers/iio/accel/adxl345_i2c.c @@ -47,10 +47,17 @@ static const struct of_device_id adxl345_of_match[] = { MODULE_DEVICE_TABLE(of, adxl345_of_match); +static const struct acpi_device_id adxl345_acpi_match[] = { + { "ADS0345", ADXL345 }, + { } +}; +MODULE_DEVICE_TABLE(acpi, adxl345_acpi_match); + static struct i2c_driver adxl345_i2c_driver = { .driver = { .name = "adxl345_i2c", .of_match_table = adxl345_of_match, + .acpi_match_table = adxl345_acpi_match, }, .probe_new = adxl345_i2c_probe, .id_table = adxl345_i2c_id, diff --git a/drivers/iio/accel/adxl345_spi.c b/drivers/iio/accel/adxl345_spi.c index ee4c50c8a95b..850ac616d65e 100644 --- a/drivers/iio/accel/adxl345_spi.c +++ b/drivers/iio/accel/adxl345_spi.c @@ -52,10 +52,17 @@ static const struct of_device_id adxl345_of_match[] = { MODULE_DEVICE_TABLE(of, adxl345_of_match); +static const struct acpi_device_id adxl345_acpi_match[] = { + { "ADS0345", ADXL345 }, + { } +}; +MODULE_DEVICE_TABLE(acpi, adxl345_acpi_match); + static struct spi_driver adxl345_spi_driver = { .driver = { .name = "adxl345_spi", .of_match_table = adxl345_of_match, + .acpi_match_table = adxl345_acpi_match, }, .probe = adxl345_spi_probe, .id_table = adxl345_spi_id, From patchwork Tue Feb 22 09:00:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12754670 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 4B569C433EF for ; Tue, 22 Feb 2022 09:00:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230056AbiBVJA0 (ORCPT ); Tue, 22 Feb 2022 04:00:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230048AbiBVJAY (ORCPT ); Tue, 22 Feb 2022 04:00:24 -0500 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0814C13D57E; Tue, 22 Feb 2022 01:00:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645520400; x=1677056400; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HeYYCpfWzDLsBB2Xg8Rn8iCJ+VSaLy0WDtFNFueGsFE=; b=igiVNytXKf1yWDbmVxXZyutktmis/H+x3KH32V2/S7L5NO9qbUeckNwE kIpgkpR2RPBODHzhAy8L0fIoIIdw+71J/BLKtLOVkdDTarwCYqnZhCUyz NvuO5mNfqX9tYsIA4YkE/YRCHY6lxioFQbkfQprDY8LEoyCmnnoA/m1mB n6iG/2qPPPgK7ywIgQ6N7/GnZhXYiJ2P6X51PpBWp6AcACalqrJTZWLjR XHHJWEQJE4ipPGX7US+9KGnMxFzPRP3cfrr6na2mXR9GSBMsDb5+1zR75 GEpFC8RkU9uQ1eiDY1GheIOx1Zo6bj7ujFnYESpYT2nYPHLkksPIba+UR A==; X-IronPort-AV: E=McAfee;i="6200,9189,10265"; a="232263798" X-IronPort-AV: E=Sophos;i="5.88,387,1635231600"; d="scan'208";a="232263798" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2022 00:59:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,387,1635231600"; d="scan'208";a="505462003" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 22 Feb 2022 00:59:57 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id D4629763; Tue, 22 Feb 2022 11:00:10 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Kai-Heng Feng Subject: [PATCH v2 6/8] iio: accel: adxl345: Extract adxl345_powerup() helper Date: Tue, 22 Feb 2022 11:00:07 +0200 Message-Id: <20220222090009.2060-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220222090009.2060-1-andriy.shevchenko@linux.intel.com> References: <20220222090009.2060-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org For the sake of symmetry and possible reuse in the future extract adxl435_powerup() helper. Signed-off-by: Andy Shevchenko --- v2: no changes drivers/iio/accel/adxl345_core.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/iio/accel/adxl345_core.c b/drivers/iio/accel/adxl345_core.c index 315a408115b3..4e4562fc35c9 100644 --- a/drivers/iio/accel/adxl345_core.c +++ b/drivers/iio/accel/adxl345_core.c @@ -209,6 +209,11 @@ static const struct iio_info adxl345_info = { .write_raw_get_fmt = adxl345_write_raw_get_fmt, }; +static int adxl345_powerup(void *regmap) +{ + return regmap_write(regmap, ADXL345_REG_POWER_CTL, ADXL345_POWER_CTL_MEASURE); +} + static void adxl345_powerdown(void *regmap) { regmap_write(regmap, ADXL345_REG_POWER_CTL, ADXL345_POWER_CTL_STANDBY); @@ -265,8 +270,7 @@ int adxl345_core_probe(struct device *dev, struct regmap *regmap) indio_dev->num_channels = ARRAY_SIZE(adxl345_channels); /* Enable measurement mode */ - ret = regmap_write(data->regmap, ADXL345_REG_POWER_CTL, - ADXL345_POWER_CTL_MEASURE); + ret = adxl345_powerup(data->regmap); if (ret < 0) return dev_err_probe(dev, ret, "Failed to enable measurement mode\n"); From patchwork Tue Feb 22 09:00:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12754668 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 9000AC433FE for ; Tue, 22 Feb 2022 09:00:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230060AbiBVJA0 (ORCPT ); Tue, 22 Feb 2022 04:00:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230045AbiBVJAY (ORCPT ); Tue, 22 Feb 2022 04:00:24 -0500 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99B3913D57B; Tue, 22 Feb 2022 00:59:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645520399; x=1677056399; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PEBKM9cjvF9E46ZXCcu9Vcaz3w5crzSB7igw+tUNYp4=; b=WMWAYlY61VDrOdrDci6D/nXLsn7yC4NZlacymdN4hbBNVrO8Vssmn92a tjuQ48b1ttFG53Q2m/WvEwgGhp6/eUsYTjgtRET6oYfwJOXc4fgpvYuvY samM9kBflibsl/IAh5E6cad3KI8MAlD6v2v3gDU41D+NJSQKyTvhcIqe0 Bp74dejAz7CBhHTuLvfEcJ+6aPey34ZgWLV79pQCT3Xc1fWWpMMJad85F dgEn1msUe3rdDez44jWduBOZc00kXVTzfPcJh0H0KnwRramwwSfkmRgIo WsDIe6dY0M+/5YlCNuCAVEHcW1k62IxE0mWzZoGBzhJg1D2JtiLd3YiJf Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10265"; a="232263794" X-IronPort-AV: E=Sophos;i="5.88,387,1635231600"; d="scan'208";a="232263794" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2022 00:59:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,387,1635231600"; d="scan'208";a="683448552" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 22 Feb 2022 00:59:57 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id E00127CC; Tue, 22 Feb 2022 11:00:10 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Kai-Heng Feng Subject: [PATCH v2 7/8] iio: accel: adxl345: Drop comma in terminator entries Date: Tue, 22 Feb 2022 11:00:08 +0200 Message-Id: <20220222090009.2060-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220222090009.2060-1-andriy.shevchenko@linux.intel.com> References: <20220222090009.2060-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Terminator entries are by definition should terminate the array. Dropping comma make this enforced at compile time. Signed-off-by: Andy Shevchenko --- v2: no changes drivers/iio/accel/adxl345_core.c | 2 +- drivers/iio/accel/adxl345_i2c.c | 2 +- drivers/iio/accel/adxl345_spi.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/accel/adxl345_core.c b/drivers/iio/accel/adxl345_core.c index 4e4562fc35c9..370bfec1275a 100644 --- a/drivers/iio/accel/adxl345_core.c +++ b/drivers/iio/accel/adxl345_core.c @@ -195,7 +195,7 @@ static IIO_CONST_ATTR_SAMP_FREQ_AVAIL( static struct attribute *adxl345_attrs[] = { &iio_const_attr_sampling_frequency_available.dev_attr.attr, - NULL, + NULL }; static const struct attribute_group adxl345_attrs_group = { diff --git a/drivers/iio/accel/adxl345_i2c.c b/drivers/iio/accel/adxl345_i2c.c index 11ecff0e0405..1ceb9be13cdf 100644 --- a/drivers/iio/accel/adxl345_i2c.c +++ b/drivers/iio/accel/adxl345_i2c.c @@ -42,7 +42,7 @@ MODULE_DEVICE_TABLE(i2c, adxl345_i2c_id); static const struct of_device_id adxl345_of_match[] = { { .compatible = "adi,adxl345", .data = (const void *)ADXL345 }, { .compatible = "adi,adxl375", .data = (const void *)ADXL375 }, - { }, + { } }; MODULE_DEVICE_TABLE(of, adxl345_of_match); diff --git a/drivers/iio/accel/adxl345_spi.c b/drivers/iio/accel/adxl345_spi.c index 850ac616d65e..2f5fc565f1f4 100644 --- a/drivers/iio/accel/adxl345_spi.c +++ b/drivers/iio/accel/adxl345_spi.c @@ -47,7 +47,7 @@ MODULE_DEVICE_TABLE(spi, adxl345_spi_id); static const struct of_device_id adxl345_of_match[] = { { .compatible = "adi,adxl345", .data = (const void *)ADXL345 }, { .compatible = "adi,adxl375", .data = (const void *)ADXL375 }, - { }, + { } }; MODULE_DEVICE_TABLE(of, adxl345_of_match); From patchwork Tue Feb 22 09:00:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12754669 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 F1E05C4167B for ; Tue, 22 Feb 2022 09:00:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229944AbiBVJA0 (ORCPT ); Tue, 22 Feb 2022 04:00:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230043AbiBVJAY (ORCPT ); Tue, 22 Feb 2022 04:00:24 -0500 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8913813D577; Tue, 22 Feb 2022 00:59:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645520399; x=1677056399; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1c9hIlH3yPx51Kr/6d+A+9A79GZySCBX2XnqF73Hkz8=; b=jF5QNGZGd+X1D/dX3n9OBgMaWuBPGFynra6XY6K+Z3z1iGkOAZs3J382 0HMfBhJVDBSbTKexkfppTMhhfdSsPCbRWt3z1419NTwMR/dLI5Q3ucn2u HjWLoEVDhdAQ5bzN2uqKPVFYdB2bJySiNcvKXNwwRiKUdNEnyLYSL0QmC QxBfVXYMKW8YTIzJg3sXaQH7CUasC2FNQGh0b8oNsH/utvo59TwtLprQK YSUvQN+5fuEeDA0663UzfAhvFPfJKYQxwt3js1PAltE2PqWYk8vhx/1Wv rbA6VvG3/2ysxBuYgGPZDtlc8M7/LiIpOruluN4XS/JWrkDpfOljAtfyS g==; X-IronPort-AV: E=McAfee;i="6200,9189,10265"; a="338076734" X-IronPort-AV: E=Sophos;i="5.88,387,1635231600"; d="scan'208";a="338076734" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2022 00:59:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,387,1635231600"; d="scan'208";a="606621831" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga004.fm.intel.com with ESMTP; 22 Feb 2022 00:59:57 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id EB82D811; Tue, 22 Feb 2022 11:00:10 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Kai-Heng Feng Subject: [PATCH v2 8/8] iio: accel: adxl345: Remove unneeded blank lines Date: Tue, 22 Feb 2022 11:00:09 +0200 Message-Id: <20220222090009.2060-8-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220222090009.2060-1-andriy.shevchenko@linux.intel.com> References: <20220222090009.2060-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Remove unneeded blank lines where they separate the data type definitions and the macros which are using them. Signed-off-by: Andy Shevchenko --- v2: no changes drivers/iio/accel/adxl345_i2c.c | 3 --- drivers/iio/accel/adxl345_spi.c | 3 --- 2 files changed, 6 deletions(-) diff --git a/drivers/iio/accel/adxl345_i2c.c b/drivers/iio/accel/adxl345_i2c.c index 1ceb9be13cdf..0d0b34cf2b69 100644 --- a/drivers/iio/accel/adxl345_i2c.c +++ b/drivers/iio/accel/adxl345_i2c.c @@ -36,7 +36,6 @@ static const struct i2c_device_id adxl345_i2c_id[] = { { "adxl375", ADXL375 }, { } }; - MODULE_DEVICE_TABLE(i2c, adxl345_i2c_id); static const struct of_device_id adxl345_of_match[] = { @@ -44,7 +43,6 @@ static const struct of_device_id adxl345_of_match[] = { { .compatible = "adi,adxl375", .data = (const void *)ADXL375 }, { } }; - MODULE_DEVICE_TABLE(of, adxl345_of_match); static const struct acpi_device_id adxl345_acpi_match[] = { @@ -62,7 +60,6 @@ static struct i2c_driver adxl345_i2c_driver = { .probe_new = adxl345_i2c_probe, .id_table = adxl345_i2c_id, }; - module_i2c_driver(adxl345_i2c_driver); MODULE_AUTHOR("Eva Rachel Retuya "); diff --git a/drivers/iio/accel/adxl345_spi.c b/drivers/iio/accel/adxl345_spi.c index 2f5fc565f1f4..aaade5808657 100644 --- a/drivers/iio/accel/adxl345_spi.c +++ b/drivers/iio/accel/adxl345_spi.c @@ -41,7 +41,6 @@ static const struct spi_device_id adxl345_spi_id[] = { { "adxl375", ADXL375 }, { } }; - MODULE_DEVICE_TABLE(spi, adxl345_spi_id); static const struct of_device_id adxl345_of_match[] = { @@ -49,7 +48,6 @@ static const struct of_device_id adxl345_of_match[] = { { .compatible = "adi,adxl375", .data = (const void *)ADXL375 }, { } }; - MODULE_DEVICE_TABLE(of, adxl345_of_match); static const struct acpi_device_id adxl345_acpi_match[] = { @@ -67,7 +65,6 @@ static struct spi_driver adxl345_spi_driver = { .probe = adxl345_spi_probe, .id_table = adxl345_spi_id, }; - module_spi_driver(adxl345_spi_driver); MODULE_AUTHOR("Eva Rachel Retuya ");