Received: by 10.223.185.116 with SMTP id b49csp3581491wrg; Mon, 26 Feb 2018 02:29:14 -0800 (PST) X-Google-Smtp-Source: AH8x226jR3LK3wosrC2HwYI75OLHvepuCnjoMzGOP+K/d/XfF3rt6FVboGUX7Gm3BzNLU2RYI5Ag X-Received: by 2002:a17:902:4201:: with SMTP id g1-v6mr10162830pld.62.1519640954459; Mon, 26 Feb 2018 02:29:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519640954; cv=none; d=google.com; s=arc-20160816; b=WNBb7aXorUshjPrnIPq0VhGFOb9nrOJCPzDdfbdqeGzbBMQPpLZ81OHNnLWgVwzk/I 4Qn67nc5LnO/i1UZD9HgRutnEd0k+55NZmhrwfbvTBw1OYD6VKdJvfz1g7Cq7B7QUADf p5BJcABG5ki0c9ioBzRb3WKdiYeAHBNO9blkE3wyr0TbZ2lgsT4sMmKz21ICW5fW3zqT mIyAWvyRKVpxljIqObgkNr+y0H2r5JD2R1anQZ966BjyVSpufWVSbORAGis3wEE6lL8v fj3hCd21fikAmsk6+8L1ZKdj4IX4rqGDp2sX8svPkUzkMPoMjSulSbc02lZGA7Brtgki nohg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=MDlnBk81P/GGuFdW7i7oRPgf0woXg75fRoeidIDXtg0=; b=ciT0n0j9gQoU7qvggF4w2JsLxQw+E7fJgLHm6fbeSRBW1xDru/8k0/0vECNhaJ99v+ QI3eui7wmGlsYim2P6MmEXQMB9tLdDu9GbIlMlDTYTzSOmDFVKk3a25tH5VIfvMo6yKM XnqYZ/5C+5+kqqsxSkeVA9zTPd0Tz5QDknsePtsFHGBJcffHvzZrNLpguXqJoRlsQnTn 7uN5/Xp481SHCjvu3LjEdw/LNutZNOkwtULC6C3t/OwV0ka09aNXfqj2waf74rT1FAGA 3lxQ3LqGSNUaQ/kxCEjQUhyYF65OS4e/T09IYaQ4r+my0XT1OjsIiXj85A3sNhoCioaz pDag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 79si2188435pga.647.2018.02.26.02.29.00; Mon, 26 Feb 2018 02:29:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752651AbeBZK0V (ORCPT + 99 others); Mon, 26 Feb 2018 05:26:21 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:48326 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752576AbeBZK0Q (ORCPT ); Mon, 26 Feb 2018 05:26:16 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 29F3D277264 From: Enric Balletbo i Serra To: lee.jones@linaro.org Cc: groeck@chromium.org, andy.shevchenko@gmail.com, kernel@collabora.com, gwendal@chromium.org, linux-kernel@vger.kernel.org, Vincent Palatin Subject: [PATCH v3 2/8] mfd: cros_ec: free IRQ automatically Date: Mon, 26 Feb 2018 11:26:00 +0100 Message-Id: <20180226102606.15093-3-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180226102606.15093-1-enric.balletbo@collabora.com> References: <20180226102606.15093-1-enric.balletbo@collabora.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vincent Palatin Free the IRQ we might have requested when removing the cros_ec device, so we can unload and reload the driver properly. Signed-off-by: Vincent Palatin Signed-off-by: Enric Balletbo i Serra Acked-by: Vincent Palatin Reviewed-by: Andy Shevchenko --- Changes in v3: - [2/8] Add Acked-by Vincent Palatin. - [2/8] Add Reviewed-by Andy Shevchenko. Changes in v2: - [2/8] Remove the free_irq in cros_ec_remove. drivers/mfd/cros_ec.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/drivers/mfd/cros_ec.c b/drivers/mfd/cros_ec.c index 74780f2964a1..ea8aa704b61e 100644 --- a/drivers/mfd/cros_ec.c +++ b/drivers/mfd/cros_ec.c @@ -119,9 +119,9 @@ int cros_ec_register(struct cros_ec_device *ec_dev) } if (ec_dev->irq) { - err = request_threaded_irq(ec_dev->irq, NULL, ec_irq_thread, - IRQF_TRIGGER_LOW | IRQF_ONESHOT, - "chromeos-ec", ec_dev); + err = devm_request_threaded_irq(dev, ec_dev->irq, NULL, + ec_irq_thread, IRQF_TRIGGER_LOW | IRQF_ONESHOT, + "chromeos-ec", ec_dev); if (err) { dev_err(dev, "Failed to request IRQ %d: %d", ec_dev->irq, err); @@ -135,7 +135,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev) dev_err(dev, "Failed to register Embedded Controller subdevice %d\n", err); - goto fail_mfd; + return err; } if (ec_dev->max_passthru) { @@ -153,7 +153,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev) dev_err(dev, "Failed to register Power Delivery subdevice %d\n", err); - goto fail_mfd; + return err; } } @@ -162,7 +162,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev) if (err) { mfd_remove_devices(dev); dev_err(dev, "Failed to register sub-devices\n"); - goto fail_mfd; + return err; } } @@ -180,11 +180,6 @@ int cros_ec_register(struct cros_ec_device *ec_dev) cros_ec_acpi_install_gpe_handler(dev); return 0; - -fail_mfd: - if (ec_dev->irq) - free_irq(ec_dev->irq, ec_dev); - return err; } EXPORT_SYMBOL(cros_ec_register); @@ -194,9 +189,6 @@ int cros_ec_remove(struct cros_ec_device *ec_dev) cros_ec_acpi_remove_gpe_handler(); - if (ec_dev->irq) - free_irq(ec_dev->irq, ec_dev); - return 0; } EXPORT_SYMBOL(cros_ec_remove); -- 2.16.1