From patchwork Fri Sep 27 02:41:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 174570 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp2904341ill; Thu, 26 Sep 2019 19:41:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqw7+B+SE1BYQiwCsrWpQ1JtovW01z7peNxrkmNJFSt7z8O2ZcK2q7sGDqekRiftBh4jmWgH X-Received: by 2002:a50:eb44:: with SMTP id z4mr2065926edp.207.1569552114345; Thu, 26 Sep 2019 19:41:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569552114; cv=none; d=google.com; s=arc-20160816; b=O8YeWXGl+9BUfAOJe6NXMLRt3hiBFnLqWWlf/o573sao0Emjaro+RUJacPY1jq8egd FATK9iYI7zepxondBMcKGgak6QhDW961nUyOgtdnHGGUbMqI1pxI9sOSrdT/Pu1xPzLc 9GI5fH6fk1bvGsldRopduMCY3/vJm5C+dRBhPl5GE6b8byODu6VwIv+zflQTWnj73CAz vl18Fp+RFFv8neOoo3pF3/VtdizeNW4xI/SK9OnIE2A6hyW63ggdGrsGcr6s0evbguwB dvoP2+KUJOjn2MHXcb8mKKr+kE3tbOaR2ii/UxHsc4FPkFVHIou2ZKT6T4HYs3mzkBpM tAAw== 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 :dkim-signature; bh=LM9q5Xx6Mzt9yNbUm921CBJVXXmEo2RSkhi8vTWfwXU=; b=CyCXqtjsxiFnA1KvvJgR12CCQj37d6K+yzuAgaaMEnMWtqJDtRVufrak5tHj4IHE3I hf9+qx9oXmQSzAaVpI2ZuNyIdqzjLh/H3B6TwcbLbL1OMRXuN2xueKowSzRFue/J3Im0 GLFNVvcpJROcNlnqsAf3KhCYEXRkaA6VnQNHzHTcISdkC+4RpmsazaKmFm5YE7ELhOIc YxZXiOR+tYpRfLe07nD6Loa4GUIyesQZWXjF36dJPBLM1/S7Okj5a6baSKENdV6wq+Bn +yM05eeBxljSvW+awhvAWNbzMbdrK64YQpxKHNmq6EOTALvvTx/ERQSDGYBt/SD73AYD EO8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FEoOSXSX; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d48si683030eda.383.2019.09.26.19.41.54; Thu, 26 Sep 2019 19:41:54 -0700 (PDT) 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; dkim=pass header.i=@linaro.org header.s=google header.b=FEoOSXSX; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728643AbfI0Clv (ORCPT + 26 others); Thu, 26 Sep 2019 22:41:51 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:35650 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727725AbfI0Clu (ORCPT ); Thu, 26 Sep 2019 22:41:50 -0400 Received: by mail-pg1-f194.google.com with SMTP id a24so2633647pgj.2 for ; Thu, 26 Sep 2019 19:41:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=LM9q5Xx6Mzt9yNbUm921CBJVXXmEo2RSkhi8vTWfwXU=; b=FEoOSXSXSqQp6XKLpQiCMZx8ATRg0h8grRkbHWwInMqhiYcwMAItrMzi+ghR2GUzYj 3tSCThNuGE2JgrilKGSBaIFFGvi9TwRLiltCvSuSemuIARRNxqQl9f+Jg2RYFm1+2jH9 xaxzZwYO3LJCKMazz+B/esndrthuEYZxrkbRu5ujttXWPwrm0jgWOt8+pcWR2sTbmBXa g/TXEcFOtYo6MA0DICHkpeXYu1ygfjhXYF+BKGcrX+QZPjSF40mbCz2P7WcbmkaPrxVC YXKiAhQNMAgrXHdH/tLl6xfmPdvRLesQnJ9zxuCa1Iv0iOlMn8/ObGC4AdlzniNeHD4F 0JUA== 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; bh=LM9q5Xx6Mzt9yNbUm921CBJVXXmEo2RSkhi8vTWfwXU=; b=mHH+HLZEaNOI2cb6dBS/bsoJWxtAlH77YxaY0J31599dHznXewX5u7iLxDR6h8tYQh ZlNoa4lnDzmUir8zZkBlgm2tbb8f5i5I2EpYAZUnk3QUWjzbuBwBUXL/qTMfcjZ6M2UI +A0Ejn9b74qdjnD3MnwHxtyh/o2xZNtDcNRBbxktsu7LF5RNqj1FbRZkXI9xmWOEo9ig QHcpol1lzZfUfGcxXw6ENi8/4v44wzb0TzqOXnfr9i3MzlZuAdQCqbXcUnOHu0GgOOoM HS9TWDi6GXnh+78qE2crCTCaWryDRSE/7uKddUyGJ4vf/AAcroHsWyyujF+UtRrgIuYX 2AUA== X-Gm-Message-State: APjAAAXrDwO+2X+gjwlSqOBq/d4N9AmOjtyjKx8h+ma40FnR7ujSVnVd YO6gtSQ/meMdNZVdn6ZkVh3mUA== X-Received: by 2002:a17:90a:ac14:: with SMTP id o20mr3945944pjq.28.1569552109806; Thu, 26 Sep 2019 19:41:49 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id k95sm3955461pje.10.2019.09.26.19.41.45 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 26 Sep 2019 19:41:48 -0700 (PDT) From: Baolin Wang To: jic23@kernel.org Cc: knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, freeman.liu@unisoc.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, baolin.wang@linaro.org, orsonzhai@gmail.com, zhang.lyra@gmail.com Subject: [PATCH] iio: adc: sc27xx: Use devm_hwspin_lock_request_specific() to simplify code Date: Fri, 27 Sep 2019 10:41:19 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Change to use devm_hwspin_lock_request_specific() to help to simplify the cleanup code for drivers requesting one hwlock. Signed-off-by: Baolin Wang --- drivers/iio/adc/sc27xx_adc.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) -- 1.7.9.5 diff --git a/drivers/iio/adc/sc27xx_adc.c b/drivers/iio/adc/sc27xx_adc.c index a6c0465..66b387f 100644 --- a/drivers/iio/adc/sc27xx_adc.c +++ b/drivers/iio/adc/sc27xx_adc.c @@ -477,13 +477,6 @@ static void sc27xx_adc_disable(void *_data) SC27XX_MODULE_ADC_EN, 0); } -static void sc27xx_adc_free_hwlock(void *_data) -{ - struct hwspinlock *hwlock = _data; - - hwspin_lock_free(hwlock); -} - static int sc27xx_adc_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -520,19 +513,12 @@ static int sc27xx_adc_probe(struct platform_device *pdev) return ret; } - sc27xx_data->hwlock = hwspin_lock_request_specific(ret); + sc27xx_data->hwlock = devm_hwspin_lock_request_specific(dev, ret); if (!sc27xx_data->hwlock) { dev_err(dev, "failed to request hwspinlock\n"); return -ENXIO; } - ret = devm_add_action_or_reset(dev, sc27xx_adc_free_hwlock, - sc27xx_data->hwlock); - if (ret) { - dev_err(dev, "failed to add hwspinlock action\n"); - return ret; - } - sc27xx_data->dev = dev; ret = sc27xx_adc_enable(sc27xx_data);