From patchwork Tue Nov 10 14:55:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 323234 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51426C63697 for ; Tue, 10 Nov 2020 14:57:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E78C520731 for ; Tue, 10 Nov 2020 14:57:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="w+ZcawHw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731450AbgKJO4O (ORCPT ); Tue, 10 Nov 2020 09:56:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731227AbgKJO4H (ORCPT ); Tue, 10 Nov 2020 09:56:07 -0500 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BD36C0613D1 for ; Tue, 10 Nov 2020 06:56:05 -0800 (PST) Received: by mail-wr1-x443.google.com with SMTP id k2so9587627wrx.2 for ; Tue, 10 Nov 2020 06:56:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=A7Q6GcsOlUvCk0TynHXF9lujyUa3NnBo8eWmuL6l7+w=; b=w+ZcawHwB0e3nB10uWI5DX6CesgFsMuEwayRrb8XkjoRWUp0F/fCC7j5OVqQ1ZPWGj tA3151tQRB2+KJHEb8MJkzDqtN0Phvg7QYOrINaW1/t21gObq8PaefxB3iOo07bLp6yr E3xmoNacZfG6A/RDC+1A6gH1QB7CizNMfRH99ZAOdBMJT4B9ApoA8ppYNSyA9jsAolxF +3ZmzwdrQVL8BGfjkRg+eYYHtMKxklpKZDQUtUae5SROj/DPYAmpI2o5rVNLFozbXHIX GiCajga5UXzrpUP7/w7fPR+DcfeYuD8CvF51qkIi2A7kQW3DyQchWcv3us+i+q4GBySD SPcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=A7Q6GcsOlUvCk0TynHXF9lujyUa3NnBo8eWmuL6l7+w=; b=b7RLG/ikVwMWZGL7xXkXuaePY3Zsdctp/POnYrm4A+gJY4YfoenEuRlp1qqk9wnBWH Hj4CxRJY/r9bBKNEP7vePlZWZ8zGtpkHJygdzVKsnsCwsrwI8ajTlgvh+8Lp4RrYG/YJ 3wzlYZHdFeHFTpzzSdWU56RF1WMIPw6YPcKIyAAH/h+l03LGWs0tIByyM3R79ayShS97 9B47pTWw0S08InmMdXHRe0zIhJK1UJ6vZE3p6Di5dlvut2tjJM/sCNL6XpXo6a1BbDzR 0xkxtSHbl6l1EvcFQIgChNirRqiGq3ULlE+dP+PhWGn0oJbHxV8hhrgZHfiR7RR66iWR 90rg== X-Gm-Message-State: AOAM533M1K64DfNOYAOySIbE4OWxsdFIyEkWa4sH2jECHQxU3ycYH3Mi vrYkDLTBv4xhnIZA9v6R3OPVgQ== X-Google-Smtp-Source: ABdhPJxOU/dttXRMN7VN6gM9Zf9mVLj8tSVjQRRNqbDf/ak/UG0PszbRWOZvfgV4zELM3w7aMe8OSA== X-Received: by 2002:adf:8304:: with SMTP id 4mr23920371wrd.215.1605020164113; Tue, 10 Nov 2020 06:56:04 -0800 (PST) Received: from debian-brgl.home (amarseille-656-1-4-167.w90-8.abo.wanadoo.fr. [90.8.158.167]) by smtp.gmail.com with ESMTPSA id f17sm3261827wmf.41.2020.11.10.06.56.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2020 06:56:03 -0800 (PST) From: Bartosz Golaszewski To: Linus Walleij , Andy Shevchenko , Jan Kiszka , David Laight Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v4 1/7] gpio: exar: add a newline after the copyright notice Date: Tue, 10 Nov 2020 15:55:46 +0100 Message-Id: <20201110145552.23024-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201110145552.23024-1-brgl@bgdev.pl> References: <20201110145552.23024-1-brgl@bgdev.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org From: Bartosz Golaszewski It's customary to have a newline between the copyright header and the includes. Add one to gpio-exar. Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpio-exar.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpio/gpio-exar.c b/drivers/gpio/gpio-exar.c index b1accfba017d..4202dd363a11 100644 --- a/drivers/gpio/gpio-exar.c +++ b/drivers/gpio/gpio-exar.c @@ -4,6 +4,7 @@ * * Copyright (C) 2015 Sudip Mukherjee */ + #include #include #include From patchwork Tue Nov 10 14:55:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 323233 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 542DCC56201 for ; Tue, 10 Nov 2020 14:57:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EF78B20731 for ; Tue, 10 Nov 2020 14:57:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="yCgj1oxm" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730980AbgKJO4K (ORCPT ); Tue, 10 Nov 2020 09:56:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731269AbgKJO4H (ORCPT ); Tue, 10 Nov 2020 09:56:07 -0500 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C575C0613CF for ; Tue, 10 Nov 2020 06:56:07 -0800 (PST) Received: by mail-wm1-x343.google.com with SMTP id a65so3278363wme.1 for ; Tue, 10 Nov 2020 06:56:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=t/9DP21Y/K7Z/VraeZB1byIXgPmUm3+JNNTaYKuJoag=; b=yCgj1oxmbWVJO6aVvwgbnT+plK9gHErnJySsC0rvLE93LMEFpncao3WCRK2Vup/Ftp EvrQK5aOtyaqccw82bjKKT0By1YBbO6mB2VIUCHAs1BbXmyAlUn7ZNr5rYeSkQPOoA2g HLnjsndjEM2rY7DKAdnMVkgmpOUSzOsEVMsrr00Sq5MfBYkn29umHdi7QLVBeUWLlzJh AcX1onVuBbUB7J66a6ZCYYynMVjHjNWINKWUBDoPAPe0xKULJ/5USryuRpPm/r7V8OKC gonR75UmoEROFpEIYWd867tsCTBgFsPGlbv7w/XO8HO33JKkV1F4f489NxT8OFiHWdSm Wk9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=t/9DP21Y/K7Z/VraeZB1byIXgPmUm3+JNNTaYKuJoag=; b=JmtM2UaG+X3Gh+7KfuSb6p1pgVAojuJiywxL3sLUDk9vB9bJT0hOBVJdS1+KDTG+// OxiqI05G7TQHwtnBdcb4mIfIgiaJu3L85j04+S6VD5yv7epYDyv13bbhwaSFF7+dZjMq 60yPLTr7am57q7vPs2EsSKSDFAyMvn+U6k34U1k5SjKTHrMA7MjLaFyfMWxrlYgtknEy TZhPmc+s+uStdmrAeXnpFLG2ft/QNkk7OInTGVNYBE31PdNV0zFJvDHJ7yiJVHFw+edp afz5KxaFoReykbDcYxiMzDfP0pPKs5oXt0+RAkRzbn4UGvmaFEsDjvjA4J2YtpvstIfB GLFA== X-Gm-Message-State: AOAM533ftiI4C7fUfkYIynfuwYmgunxW8GBs99SjnVJNf0S3Sa7zkktQ qPwc+2bDThwBqkH5MUeWRvfAU1HzpktMpQ== X-Google-Smtp-Source: ABdhPJzM0Wppb5vLfoZiyRJDDDkhJ0pmMKa0I+sNKbEvWvqYYWvGmSu7oNwQqM1QJgr9I+msZ4mQWQ== X-Received: by 2002:a1c:dc43:: with SMTP id t64mr24205wmg.93.1605020165987; Tue, 10 Nov 2020 06:56:05 -0800 (PST) Received: from debian-brgl.home (amarseille-656-1-4-167.w90-8.abo.wanadoo.fr. [90.8.158.167]) by smtp.gmail.com with ESMTPSA id f17sm3261827wmf.41.2020.11.10.06.56.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2020 06:56:05 -0800 (PST) From: Bartosz Golaszewski To: Linus Walleij , Andy Shevchenko , Jan Kiszka , David Laight Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v4 2/7] gpio: exar: include idr.h Date: Tue, 10 Nov 2020 15:55:47 +0100 Message-Id: <20201110145552.23024-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201110145552.23024-1-brgl@bgdev.pl> References: <20201110145552.23024-1-brgl@bgdev.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org From: Bartosz Golaszewski This driver uses IDA APIs but doesn't include the relevant header. This fixes it. Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpio-exar.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpio/gpio-exar.c b/drivers/gpio/gpio-exar.c index 4202dd363a11..1941ae533418 100644 --- a/drivers/gpio/gpio-exar.c +++ b/drivers/gpio/gpio-exar.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include From patchwork Tue Nov 10 14:55:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 323235 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FBB7C55ABD for ; Tue, 10 Nov 2020 14:56:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C7B312076E for ; Tue, 10 Nov 2020 14:56:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="dHlBKlol" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732326AbgKJO42 (ORCPT ); Tue, 10 Nov 2020 09:56:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731562AbgKJO4P (ORCPT ); Tue, 10 Nov 2020 09:56:15 -0500 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 437DDC0617A7 for ; Tue, 10 Nov 2020 06:56:14 -0800 (PST) Received: by mail-wm1-x343.google.com with SMTP id h2so3293067wmm.0 for ; Tue, 10 Nov 2020 06:56:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IQh6Jo5zoHL7/3I5hGMlwjltjV3kz9H+4fZOBa3eDu8=; b=dHlBKlolnhqDQUiW04dQgyoqrmqH4sPOBeDpM+s/gEPkY9Fd552NUSYcptJJCPHOk7 ak6DPDgZ5pgdVJQ/LlxjCMqrETWDnz1Y7QPIM/e/6v1f06k3U9v/uRj+QnuruoU8yik6 PE22kni59Wt8ooHuvyLlSYaG2BA1AzVYuV/k9Msd3cXyFcO36UvvKC2iJ93qmhYZqJ8c u/d3Hzxfa9QaHfJENsmfkiN5nWIPx8HU88R5Adok4gUIHTbKghxsZyS2DjR8iotznRqN iXawjQznG4Enn1JEOuPZnXvZiPQeqfJvKZYeFkGdYYOfFiSgCy0b7A9tV7fkCBnfwsgV WUTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IQh6Jo5zoHL7/3I5hGMlwjltjV3kz9H+4fZOBa3eDu8=; b=EL92ierFbBSfTY0cuIaWfyP+uirk0wmJWAQt6klZpF7slx7idPQELxu5vPZ8cY8P0Y 4P7tGMXKpMnNl6+DUVkPVYrV4PJRCKXd3C5tkzIkhH12HwwU3FyDgOBU2bLoLgjAhZn2 IAZ0/dIBx02jagX4BsyQSYPUOkKYxX9lByElUa/s2dqp2+TZeRVGR1HTN7T+Uv/+iz1F /RG2JCilbPobGLZwLvOK7O2FeNa4yeU0g58JbU8FV75rvS6KaeL45tdLEnK5fqeyUFmh DvnLitvOT7h+UBIRctjMNuCm2pfh+tKSh2kgNrF/V393U6xXC1sLZRtIByQe4Vhxg1vU TuIA== X-Gm-Message-State: AOAM5330PsP5+oMto7UFohcZSb9VUHp+YgttHEvw+DXc1q4SBld0NxAQ +iVP3JQFciszMJnf7Z8etUCJjQ== X-Google-Smtp-Source: ABdhPJzHAt9kZO/l5er2IvaDzk5nsY8wRTuZO4a5c5akLJXdSs7Q4ajjgdyStZuZs6jxse0ZVMn6lg== X-Received: by 2002:a1c:9e12:: with SMTP id h18mr42650wme.11.1605020173067; Tue, 10 Nov 2020 06:56:13 -0800 (PST) Received: from debian-brgl.home (amarseille-656-1-4-167.w90-8.abo.wanadoo.fr. [90.8.158.167]) by smtp.gmail.com with ESMTPSA id f17sm3261827wmf.41.2020.11.10.06.56.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2020 06:56:12 -0800 (PST) From: Bartosz Golaszewski To: Linus Walleij , Andy Shevchenko , Jan Kiszka , David Laight Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v4 7/7] gpio: exar: use devm action for freeing the IDA and drop remove() Date: Tue, 10 Nov 2020 15:55:52 +0100 Message-Id: <20201110145552.23024-8-brgl@bgdev.pl> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201110145552.23024-1-brgl@bgdev.pl> References: <20201110145552.23024-1-brgl@bgdev.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org From: Bartosz Golaszewski We can simplify the error path in probe() and drop remove() entirely if we provide a devm action for freeing the device ID. Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpio-exar.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/drivers/gpio/gpio-exar.c b/drivers/gpio/gpio-exar.c index 2fdca872c7c0..d37de78247a6 100644 --- a/drivers/gpio/gpio-exar.c +++ b/drivers/gpio/gpio-exar.c @@ -111,6 +111,13 @@ static int exar_direction_input(struct gpio_chip *chip, unsigned int offset) return 0; } +static void exar_devm_ida_free(void *data) +{ + struct exar_gpio_chip *exar_gpio = data; + + ida_free(&ida_index, exar_gpio->index); +} + static const struct regmap_config exar_regmap_config = { .name = "exar-gpio", .reg_bits = 16, @@ -158,6 +165,10 @@ static int gpio_exar_probe(struct platform_device *pdev) if (index < 0) return index; + ret = devm_add_action_or_reset(dev, exar_devm_ida_free, exar_gpio); + if (ret) + return ret; + sprintf(exar_gpio->name, "exar_gpio%d", index); exar_gpio->gpio_chip.label = exar_gpio->name; exar_gpio->gpio_chip.parent = dev; @@ -173,29 +184,15 @@ static int gpio_exar_probe(struct platform_device *pdev) ret = devm_gpiochip_add_data(dev, &exar_gpio->gpio_chip, exar_gpio); if (ret) - goto err_destroy; + return ret; platform_set_drvdata(pdev, exar_gpio); - return 0; - -err_destroy: - ida_free(&ida_index, index); - return ret; -} - -static int gpio_exar_remove(struct platform_device *pdev) -{ - struct exar_gpio_chip *exar_gpio = platform_get_drvdata(pdev); - - ida_free(&ida_index, exar_gpio->index); - return 0; } static struct platform_driver gpio_exar_driver = { .probe = gpio_exar_probe, - .remove = gpio_exar_remove, .driver = { .name = DRIVER_NAME, },