Received: by 10.223.185.116 with SMTP id b49csp4274114wrg; Mon, 19 Feb 2018 14:42:59 -0800 (PST) X-Google-Smtp-Source: AH8x225x0EHzKXQ6EBU4a0fLIrdxOLqvOW4KiWfU78/6ndiNNExc7rVMiJeX05fLmLViLTQIlRwE X-Received: by 2002:a17:902:848b:: with SMTP id c11-v6mr12025564plo.372.1519080179408; Mon, 19 Feb 2018 14:42:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519080179; cv=none; d=google.com; s=arc-20160816; b=wKQ/nMQ0BOTNxviw5Cc4ERJAf6fU1bc3G3T3JQSyPjKy50sTd0IDXR3V2BMYbQzfzT TvZ7rFr979J8a6RPChqYB+FzUQiFdM5ULSZwBLxO6ki26IB98HlDtz+bwG8FSbW1gCe/ vnggx32Z7xLximg4BBmvNnEhjk6loxIcYxx1YlMdegH5PdcDqlaADL0LVp0isCu+eSkZ Pocgc+1oTnGigRHNFddRmEtgMb+pzIGYmR3Yy64lrtCR/kghrHGttGltL+DittNcOivg O0QBzKISgTmpSPc66MzL9rz2kFZ9neyLcKw5Xu791IG+CbheLnhQSbDeV4HJHYX7pZdg 02dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=KLCpZz5HAR0Ey4ohuC5qMH2PPV6Gvnt3gvfDel9O8WY=; b=IzQZNzVB99tQmY8AdSlvomeDxdlvh2TA6wy8O/fDQruR9rLzgENxgMUcit3uj6e3ZO CmObsQeOKsy1rXDBoNmirPWzRGVtkQOMzXg5Gh/sowWzKTEjLJSjgmlIzuTHdrgfIMIa AsI9ONWwpp8WLL2NIdVvIQeoRoxjTTpLEuq0WqHkpCy4Df128odOOz2TgAm2oRk7zUoe ls4HKwzCfzwoxNZd+hajIL30lZWTVyQcQ72Q+jYtNMkqSbXTpbzKfYxpuz07WJRJhyK/ 4vUH5T8o5rNMzyL9s6F8DdMnxoMlCmkkVTRjOE2ukHW0gjLAxMctjj27HhMAhe/Fl/RF Pt8g== 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 s24si528263pfj.121.2018.02.19.14.42.45; Mon, 19 Feb 2018 14:42:59 -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 S932223AbeBSWkw (ORCPT + 99 others); Mon, 19 Feb 2018 17:40:52 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:46544 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932163AbeBSWkv (ORCPT ); Mon, 19 Feb 2018 17:40:51 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id CD915260EA0 From: Enric Balletbo i Serra To: Lee Jones Cc: groeck@chromium.org, gwendal@chromium.org, bleung@chromium.org, linux-kernel@vger.kernel.org, kernel@collabora.com, Vincent Palatin Subject: [PATCH 2/6] mfd: cros_ec: free IRQ automatically Date: Mon, 19 Feb 2018 23:40:43 +0100 Message-Id: <20180219224043.21383-1-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.16.1 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 --- drivers/mfd/cros_ec.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/mfd/cros_ec.c b/drivers/mfd/cros_ec.c index 74780f2964a1..d1a4fbee9380 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); -- 2.16.1