From patchwork Mon Jul 11 21:35:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 589599 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 D07BCC433EF for ; Mon, 11 Jul 2022 21:35:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229834AbiGKVf3 (ORCPT ); Mon, 11 Jul 2022 17:35:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229591AbiGKVf2 (ORCPT ); Mon, 11 Jul 2022 17:35:28 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E090E2714D; Mon, 11 Jul 2022 14:35:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657575327; x=1689111327; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=H6ArmHTQ6yeMw2auxyxhCIrckwMnvtSOg5e2BDHKOUU=; b=dnZHvjG9owpQbE6SWn536KKa9xpY9lcEd8ky0KiGTu4iUeLVyzZ6w1mJ 4gHa0JoxKSf8Cas4uhReC+YrVDwYR8fYGaQQc4cYqwtsJPf0e8Cy5YUOo RcFBeVFxCa0NrLhYwZ5y44dzcC/Ny1KmyII0A1x0wKWHB4irImkzPfmuP GceJj/A0PH4RsJ1B2Y6czug3K7I9nFwRlpxBNvbEupt5SpQNeVjmhktk9 9TpfK5aedUFpRzJ6CdIvhRU9wwQexi7veTb4xsFQxbUe85hpQVjbiW74T 3nTAAx8ZWpMq3u2gnxBU2sPbUWgC3p1Bn6owzovCSprHvq7WVhYuJRoJb Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10405"; a="310383929" X-IronPort-AV: E=Sophos;i="5.92,263,1650956400"; d="scan'208";a="310383929" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2022 14:35:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,263,1650956400"; d="scan'208";a="599165379" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 11 Jul 2022 14:35:25 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 6C4271A0; Tue, 12 Jul 2022 00:35:33 +0300 (EEST) From: Andy Shevchenko To: Pavel Machek , Linus Walleij , Andy Shevchenko , Vincent Knecht , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 1/5] leds: is31fl319x: Make use of device properties Date: Tue, 12 Jul 2022 00:35:20 +0300 Message-Id: <20220711213524.3587-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-leds@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/leds/Kconfig | 2 +- drivers/leds/leds-is31fl319x.c | 44 ++++++++++++++++------------------ 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index a49979f41eee..9a896be26dc7 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -697,7 +697,7 @@ config LEDS_MENF21BMC config LEDS_IS31FL319X tristate "LED Support for ISSI IS31FL319x I2C LED controller family" - depends on LEDS_CLASS && I2C && OF + depends on LEDS_CLASS && I2C select REGMAP_I2C help This option enables support for LEDs connected to ISSI IS31FL319x diff --git a/drivers/leds/leds-is31fl319x.c b/drivers/leds/leds-is31fl319x.c index 056cf3bcffdc..b1a0ca340e24 100644 --- a/drivers/leds/leds-is31fl319x.c +++ b/drivers/leds/leds-is31fl319x.c @@ -11,9 +11,9 @@ #include #include #include +#include #include -#include -#include +#include #include #include #include @@ -362,25 +362,23 @@ static const struct of_device_id of_is31fl319x_match[] = { }; MODULE_DEVICE_TABLE(of, of_is31fl319x_match); -static int is31fl319x_parse_child_dt(const struct device *dev, - const struct device_node *child, +static int is31fl319x_parse_child_fw(const struct device *dev, + const struct fwnode_handle *child, struct is31fl319x_led *led, struct is31fl319x_chip *is31) { struct led_classdev *cdev = &led->cdev; int ret; - if (of_property_read_string(child, "label", &cdev->name)) - cdev->name = child->name; + if (fwnode_property_read_string(child, "label", &cdev->name)) + cdev->name = fwnode_get_name(child); - ret = of_property_read_string(child, "linux,default-trigger", - &cdev->default_trigger); + ret = fwnode_property_read_string(child, "linux,default-trigger", &cdev->default_trigger); if (ret < 0 && ret != -EINVAL) /* is optional */ return ret; led->max_microamp = is31->cdef->current_default; - ret = of_property_read_u32(child, "led-max-microamp", - &led->max_microamp); + ret = fwnode_property_read_u32(child, "led-max-microamp", &led->max_microamp); if (!ret) { if (led->max_microamp < is31->cdef->current_min) return -EINVAL; /* not supported */ @@ -391,16 +389,12 @@ static int is31fl319x_parse_child_dt(const struct device *dev, return 0; } -static int is31fl319x_parse_dt(struct device *dev, - struct is31fl319x_chip *is31) +static int is31fl319x_parse_fw(struct device *dev, struct is31fl319x_chip *is31) { - struct device_node *np = dev_of_node(dev), *child; + struct fwnode_handle *fwnode = dev_fwnode(dev), *child; int count; int ret; - if (!np) - return -ENODEV; - is31->shutdown_gpio = devm_gpiod_get_optional(dev, "shutdown", GPIOD_OUT_HIGH); if (IS_ERR(is31->shutdown_gpio)) { ret = PTR_ERR(is31->shutdown_gpio); @@ -410,7 +404,9 @@ static int is31fl319x_parse_dt(struct device *dev, is31->cdef = device_get_match_data(dev); - count = of_get_available_child_count(np); + count = 0; + fwnode_for_each_available_child_node(fwnode, child) + count++; dev_dbg(dev, "probing with %d leds defined in DT\n", count); @@ -420,11 +416,11 @@ static int is31fl319x_parse_dt(struct device *dev, return -ENODEV; } - for_each_available_child_of_node(np, child) { + fwnode_for_each_available_child_node(fwnode, child) { struct is31fl319x_led *led; u32 reg; - ret = of_property_read_u32(child, "reg", ®); + ret = fwnode_property_read_u32(child, "reg", ®); if (ret) { dev_err(dev, "Failed to read led 'reg' property\n"); goto put_child_node; @@ -444,7 +440,7 @@ static int is31fl319x_parse_dt(struct device *dev, goto put_child_node; } - ret = is31fl319x_parse_child_dt(dev, child, led, is31); + ret = is31fl319x_parse_child_fw(dev, child, led, is31); if (ret) { dev_err(dev, "led %u DT parsing failed\n", reg); goto put_child_node; @@ -455,7 +451,7 @@ static int is31fl319x_parse_dt(struct device *dev, is31->audio_gain_db = 0; if (is31->cdef->is_3196or3199) { - ret = of_property_read_u32(np, "audio-gain-db", &is31->audio_gain_db); + ret = fwnode_property_read_u32(fwnode, "audio-gain-db", &is31->audio_gain_db); if (!ret) is31->audio_gain_db = min(is31->audio_gain_db, IS31FL3196_AUDIO_GAIN_DB_MAX); @@ -464,7 +460,7 @@ static int is31fl319x_parse_dt(struct device *dev, return 0; put_child_node: - of_node_put(child); + fwnode_handle_put(child); return ret; } @@ -521,7 +517,7 @@ static int is31fl319x_probe(struct i2c_client *client, mutex_init(&is31->lock); - err = is31fl319x_parse_dt(&client->dev, is31); + err = is31fl319x_parse_fw(&client->dev, is31); if (err) goto free_mutex; @@ -619,7 +615,7 @@ MODULE_DEVICE_TABLE(i2c, is31fl319x_id); static struct i2c_driver is31fl319x_driver = { .driver = { .name = "leds-is31fl319x", - .of_match_table = of_match_ptr(of_is31fl319x_match), + .of_match_table = of_is31fl319x_match, }, .probe = is31fl319x_probe, .remove = is31fl319x_remove, From patchwork Mon Jul 11 21:35:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 590184 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 515D0C43334 for ; Mon, 11 Jul 2022 21:35:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229896AbiGKVfa (ORCPT ); Mon, 11 Jul 2022 17:35:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229617AbiGKVf3 (ORCPT ); Mon, 11 Jul 2022 17:35:29 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02B132714E; Mon, 11 Jul 2022 14:35:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657575327; x=1689111327; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=WepEYXWNkKtUNB934NK3NkDIk/AZ9SLeWeiU6/NlxkI=; b=QYduBDe/zBTBJ5m19HqyRarXXjKl3zNJlv6DgW87UfrduErmsNF5mZCj 5XX+yKFnJSoVST4E4Bo104J7L2GfVUh0PiJreN5a+MbablI4QjmexdyIj 5cBCucvI/FFXZN+eoaWWi8i0vxvyQRR61Mcoi/wyiwviuYqn+gDb4AJfo 6tZHduxzjM7IGaTERmAIhca9sF/igNu9ZH23o2mP4ByOOwMqDfrIlgKzX G7t90eUH8nOPp52TniqegtpTBWpHRIUW5TBpPZxZ4Qt/BzKcvbtzevTlh 4zXdFzsMR9tVdEoqOEymnLbIvOteHhFlUImkytlBb/Yq4GIpuNutEcbp7 A==; X-IronPort-AV: E=McAfee;i="6400,9594,10405"; a="348752150" X-IronPort-AV: E=Sophos;i="5.92,263,1650956400"; d="scan'208";a="348752150" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2022 14:35:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,263,1650956400"; d="scan'208";a="771651598" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga005.jf.intel.com with ESMTP; 11 Jul 2022 14:35:25 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 7B9F3AD; Tue, 12 Jul 2022 00:35:33 +0300 (EEST) From: Andy Shevchenko To: Pavel Machek , Linus Walleij , Andy Shevchenko , Vincent Knecht , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 2/5] leds: is31fl319x: Make use of dev_err_probe() Date: Tue, 12 Jul 2022 00:35:21 +0300 Message-Id: <20220711213524.3587-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220711213524.3587-1-andriy.shevchenko@linux.intel.com> References: <20220711213524.3587-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Simplify the error handling in probe function by switching from dev_err() to dev_err_probe(). Signed-off-by: Andy Shevchenko --- drivers/leds/leds-is31fl319x.c | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/drivers/leds/leds-is31fl319x.c b/drivers/leds/leds-is31fl319x.c index b1a0ca340e24..d9cf70505c43 100644 --- a/drivers/leds/leds-is31fl319x.c +++ b/drivers/leds/leds-is31fl319x.c @@ -396,11 +396,9 @@ static int is31fl319x_parse_fw(struct device *dev, struct is31fl319x_chip *is31) int ret; is31->shutdown_gpio = devm_gpiod_get_optional(dev, "shutdown", GPIOD_OUT_HIGH); - if (IS_ERR(is31->shutdown_gpio)) { - ret = PTR_ERR(is31->shutdown_gpio); - dev_err(dev, "Failed to get shutdown gpio: %d\n", ret); - return ret; - } + if (IS_ERR(is31->shutdown_gpio)) + return dev_err_probe(dev, PTR_ERR(is31->shutdown_gpio), + "Failed to get shutdown gpio\n"); is31->cdef = device_get_match_data(dev); @@ -410,11 +408,10 @@ static int is31fl319x_parse_fw(struct device *dev, struct is31fl319x_chip *is31) dev_dbg(dev, "probing with %d leds defined in DT\n", count); - if (!count || count > is31->cdef->num_leds) { - dev_err(dev, "Number of leds defined must be between 1 and %u\n", - is31->cdef->num_leds); - return -ENODEV; - } + if (!count || count > is31->cdef->num_leds) + return dev_err_probe(dev, -ENODEV, + "Number of leds defined must be between 1 and %u\n", + is31->cdef->num_leds); fwnode_for_each_available_child_node(fwnode, child) { struct is31fl319x_led *led; @@ -422,27 +419,25 @@ static int is31fl319x_parse_fw(struct device *dev, struct is31fl319x_chip *is31) ret = fwnode_property_read_u32(child, "reg", ®); if (ret) { - dev_err(dev, "Failed to read led 'reg' property\n"); + ret = dev_err_probe(dev, ret, "Failed to read led 'reg' property\n"); goto put_child_node; } if (reg < 1 || reg > is31->cdef->num_leds) { - dev_err(dev, "invalid led reg %u\n", reg); - ret = -EINVAL; + ret = dev_err_probe(dev, -EINVAL, "invalid led reg %u\n", reg); goto put_child_node; } led = &is31->leds[reg - 1]; if (led->configured) { - dev_err(dev, "led %u is already configured\n", reg); - ret = -EINVAL; + ret = dev_err_probe(dev, -EINVAL, "led %u is already configured\n", reg); goto put_child_node; } ret = is31fl319x_parse_child_fw(dev, child, led, is31); if (ret) { - dev_err(dev, "led %u DT parsing failed\n", reg); + ret = dev_err_probe(dev, ret, "led %u DT parsing failed\n", reg); goto put_child_node; } @@ -530,8 +525,7 @@ static int is31fl319x_probe(struct i2c_client *client, is31->client = client; is31->regmap = devm_regmap_init_i2c(client, is31->cdef->is31fl319x_regmap_config); if (IS_ERR(is31->regmap)) { - dev_err(&client->dev, "failed to allocate register map\n"); - err = PTR_ERR(is31->regmap); + err = dev_err_probe(dev, PTR_ERR(is31->regmap), "failed to allocate register map\n"); goto free_mutex; } @@ -540,8 +534,7 @@ static int is31fl319x_probe(struct i2c_client *client, /* check for write-reply from chip (we can't read any registers) */ err = regmap_write(is31->regmap, is31->cdef->reset_reg, 0x00); if (err < 0) { - dev_err(&client->dev, "no response from chip write: err = %d\n", err); - err = -EIO; /* does not answer */ + err = dev_err_probe(dev, err, "no response from chip write\n"); goto free_mutex; } From patchwork Mon Jul 11 21:35: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: 590183 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 065EDCCA47F for ; Mon, 11 Jul 2022 21:35:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230036AbiGKVfb (ORCPT ); Mon, 11 Jul 2022 17:35:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229789AbiGKVf3 (ORCPT ); Mon, 11 Jul 2022 17:35:29 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EC1527173; Mon, 11 Jul 2022 14:35:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657575328; x=1689111328; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=NYFzjtjo3hI3b196haT7JB1le3WzmcyUxNaCDlrIrJ0=; b=dUmxBhYhlQbKYv+6r0EIn78kRE71TpHxZNwSD/TiyBQhDSVbzlY5KVKD +MDe5Qa6eCdssILq+q1RjgeXAcNhy3JGEOjyTs5ujQu7oha1v8K7HUwQa m2oHDUvmBUhdaTi1goNALCt7Z0109/bhI2gcj8b8IxjsoRbSlKtcwd01T TwwaJoU1gz765zCFbAlv/5HGfPLxuOzH3dSAK/5a1dmYxA67zjAm0FBv2 r6bRsIhPSXt0AaCB+6ZcshANB8lOBuJ91+kCHdoNc594/y/RAi5N+1zEk vE+hGlek+pItTJW74fILZuyZL00UaxcBsih4SUBajBp+ATumDvSkEDoq/ A==; X-IronPort-AV: E=McAfee;i="6400,9594,10405"; a="346458131" X-IronPort-AV: E=Sophos;i="5.92,263,1650956400"; d="scan'208";a="346458131" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2022 14:35:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,263,1650956400"; d="scan'208";a="684535812" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 11 Jul 2022 14:35:25 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 83204400; Tue, 12 Jul 2022 00:35:33 +0300 (EEST) From: Andy Shevchenko To: Pavel Machek , Linus Walleij , Andy Shevchenko , Vincent Knecht , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 3/5] leds: is31fl319x: Fix devm vs. non-devm ordering Date: Tue, 12 Jul 2022 00:35:22 +0300 Message-Id: <20220711213524.3587-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220711213524.3587-1-andriy.shevchenko@linux.intel.com> References: <20220711213524.3587-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org When non-devm resources are allocated they mustn't be followed by devm allocations, otherwise it will break the tear down ordering and might lead to crashes or other bugs during ->remove() stage. Fix this by wrapping mutex_destroy() call with devm_add_action_or_reset(). Signed-off-by: Andy Shevchenko --- drivers/leds/leds-is31fl319x.c | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/drivers/leds/leds-is31fl319x.c b/drivers/leds/leds-is31fl319x.c index d9cf70505c43..233ed67830a3 100644 --- a/drivers/leds/leds-is31fl319x.c +++ b/drivers/leds/leds-is31fl319x.c @@ -511,10 +511,13 @@ static int is31fl319x_probe(struct i2c_client *client, return -ENOMEM; mutex_init(&is31->lock); + err = devm_add_action(dev, (void (*)(void *))mutex_destroy, &is31->lock); + if (err) + return err; err = is31fl319x_parse_fw(&client->dev, is31); if (err) - goto free_mutex; + return err; if (is31->shutdown_gpio) { gpiod_direction_output(is31->shutdown_gpio, 0); @@ -524,19 +527,15 @@ static int is31fl319x_probe(struct i2c_client *client, is31->client = client; is31->regmap = devm_regmap_init_i2c(client, is31->cdef->is31fl319x_regmap_config); - if (IS_ERR(is31->regmap)) { - err = dev_err_probe(dev, PTR_ERR(is31->regmap), "failed to allocate register map\n"); - goto free_mutex; - } + if (IS_ERR(is31->regmap)) + return dev_err_probe(dev, PTR_ERR(is31->regmap), "failed to allocate register map\n"); i2c_set_clientdata(client, is31); /* check for write-reply from chip (we can't read any registers) */ err = regmap_write(is31->regmap, is31->cdef->reset_reg, 0x00); - if (err < 0) { - err = dev_err_probe(dev, err, "no response from chip write\n"); - goto free_mutex; - } + if (err < 0) + return dev_err_probe(dev, err, "no response from chip write\n"); /* * Kernel conventions require per-LED led-max-microamp property. @@ -568,22 +567,10 @@ static int is31fl319x_probe(struct i2c_client *client, err = devm_led_classdev_register(&client->dev, &led->cdev); if (err < 0) - goto free_mutex; + return err; } return 0; - -free_mutex: - mutex_destroy(&is31->lock); - return err; -} - -static int is31fl319x_remove(struct i2c_client *client) -{ - struct is31fl319x_chip *is31 = i2c_get_clientdata(client); - - mutex_destroy(&is31->lock); - return 0; } /* @@ -611,7 +598,6 @@ static struct i2c_driver is31fl319x_driver = { .of_match_table = of_is31fl319x_match, }, .probe = is31fl319x_probe, - .remove = is31fl319x_remove, .id_table = is31fl319x_id, }; From patchwork Mon Jul 11 21:35:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 589597 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 A1A45CCA482 for ; Mon, 11 Jul 2022 21:35:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230117AbiGKVfc (ORCPT ); Mon, 11 Jul 2022 17:35:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229733AbiGKVf3 (ORCPT ); Mon, 11 Jul 2022 17:35:29 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A82D22717A; Mon, 11 Jul 2022 14:35:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657575328; x=1689111328; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=FQe57KEmBLslNh9Y1duRWYZHRmbKKEi9R/4+thYRIlo=; b=kLeaiXKx50IzQc+Mbyv3KCFxdOz6OOIJMgO56ogzjtLzlAfmAGqw9bE0 QhrVzxgcFVqLcLSdvTKZQu7uBgqZVRPDXpAkPtMxURC5Ro5DBo0hwu398 oUrjHjmCn3lNNg+EMC7KJv8WNjBm2t9iVIb4j7n6bDUAFIdf/Nk60p9DG 2O8DxqEaPctRqBjiyFn+6Q/UGaSZ1SFbCCZHrM5HZu2FHD3WNvmB+7QlE YUJceKE2uxmpLMRGhBxdi1wZC3lTt4dKn2SEf55Jwu3KuHx+n31HGOfSm 9nB5uYpX9LqhwTCutdLTIOJFPcPp67p/GC3CpFqUgMqCkXyOZHTFhh2Kc Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10405"; a="310383931" X-IronPort-AV: E=Sophos;i="5.92,263,1650956400"; d="scan'208";a="310383931" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2022 14:35:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,263,1650956400"; d="scan'208";a="841148414" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga006.fm.intel.com with ESMTP; 11 Jul 2022 14:35:25 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 90F905AD; Tue, 12 Jul 2022 00:35:33 +0300 (EEST) From: Andy Shevchenko To: Pavel Machek , Linus Walleij , Andy Shevchenko , Vincent Knecht , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 4/5] leds: is31fl319x: use simple i2c probe function Date: Tue, 12 Jul 2022 00:35:23 +0300 Message-Id: <20220711213524.3587-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220711213524.3587-1-andriy.shevchenko@linux.intel.com> References: <20220711213524.3587-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org The i2c probe functions here don't use the id information provided in their second argument, so the single-parameter i2c probe function ("probe_new") can be used instead. Signed-off-by: Andy Shevchenko --- drivers/leds/leds-is31fl319x.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/leds/leds-is31fl319x.c b/drivers/leds/leds-is31fl319x.c index 233ed67830a3..52b59b62f437 100644 --- a/drivers/leds/leds-is31fl319x.c +++ b/drivers/leds/leds-is31fl319x.c @@ -494,8 +494,7 @@ static inline int is31fl3196_db_to_gain(u32 dezibel) return dezibel / IS31FL3196_AUDIO_GAIN_DB_STEP; } -static int is31fl319x_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int is31fl319x_probe(struct i2c_client *client) { struct is31fl319x_chip *is31; struct device *dev = &client->dev; @@ -597,7 +596,7 @@ static struct i2c_driver is31fl319x_driver = { .name = "leds-is31fl319x", .of_match_table = of_is31fl319x_match, }, - .probe = is31fl319x_probe, + .probe_new = is31fl319x_probe, .id_table = is31fl319x_id, }; From patchwork Mon Jul 11 21:35:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 589598 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 DCC89CCA47B for ; Mon, 11 Jul 2022 21:35:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229934AbiGKVfb (ORCPT ); Mon, 11 Jul 2022 17:35:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229704AbiGKVf3 (ORCPT ); Mon, 11 Jul 2022 17:35:29 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 123ED27154; Mon, 11 Jul 2022 14:35:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657575328; x=1689111328; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=ITmJehlTeY0Jspvd4mmNPMY0ltE3dJzEIxfg7goZ1kQ=; b=Q+mb5WLjFgY18ELXf3hxKfbMHW8aVukplnjoi6JPTuU3RDhWLtZF/RCW guXe1f05ofafTByV0/9isTiYvxU2o8+iaN8B6tho2ESFRwzS2twkSrNT2 hYQbHGKsXeD+5S4YT8IfFmcnQs8Ay0Nzx4HPHM0tVkkzvkINutzkO1njQ UtMBQOKoMGTkVZzkgw89Y5CDb/307yMUpqT8OPBGJx4hQhMF8nFwOPFZB 2//zwABG5FPcFh9qb8v7W6RgJNYzlS6s4sTFfi+gFQT4TfU3LL9QFwXvP wveMPkurHTrFaBDkNm/OrU5OYHMlbp9i0+hqNsKqHq4btlNLuvTb4Ehv6 w==; X-IronPort-AV: E=McAfee;i="6400,9594,10405"; a="284800682" X-IronPort-AV: E=Sophos;i="5.92,263,1650956400"; d="scan'208";a="284800682" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2022 14:35:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,263,1650956400"; d="scan'208";a="652633392" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 11 Jul 2022 14:35:25 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 97DBA5CC; Tue, 12 Jul 2022 00:35:33 +0300 (EEST) From: Andy Shevchenko To: Pavel Machek , Linus Walleij , Andy Shevchenko , Vincent Knecht , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 5/5] leds: is31fl319x: sort header inclusion alphabetically Date: Tue, 12 Jul 2022 00:35:24 +0300 Message-Id: <20220711213524.3587-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220711213524.3587-1-andriy.shevchenko@linux.intel.com> References: <20220711213524.3587-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Sort header inclusion alphabetically. Signed-off-by: Andy Shevchenko --- drivers/leds/leds-is31fl319x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/leds/leds-is31fl319x.c b/drivers/leds/leds-is31fl319x.c index 52b59b62f437..f2d05ae91753 100644 --- a/drivers/leds/leds-is31fl319x.c +++ b/drivers/leds/leds-is31fl319x.c @@ -8,7 +8,9 @@ * effect LEDs. */ +#include #include +#include #include #include #include @@ -16,8 +18,6 @@ #include #include #include -#include -#include /* register numbers */ #define IS31FL319X_SHUTDOWN 0x00