From patchwork Fri Sep 27 07:10:44 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: 174588 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp3112758ill; Fri, 27 Sep 2019 00:11:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqwKhbSrUTm1C3gJz4iPwp6UMZj8Old995WmNvVJmBPsT3qyGNDNckE+T68Y5kwfH8WsO+vy X-Received: by 2002:a50:d51b:: with SMTP id u27mr2828726edi.249.1569568277387; Fri, 27 Sep 2019 00:11:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569568277; cv=none; d=google.com; s=arc-20160816; b=ttCNTu81bgA8hVRuFLgAZ2uqY+xoVJv3phjbh3qdNku+fKHU/GiyMBu/W1u1+WSR8/ bSsq9eOvrZxLhCIgaDO5BBFOe5qOdoFlZcccXxNGOJCLgN4dKA1PNEC2+2M2CImtWKPq TQCZf4rY6iTk53uc3mxX12XHQsAvqAWh/YUgGRaTJiFaPefXcX4LShwJsaDJmmT51nse uCbxzW/BeTS7hFX39K9Dd16kZXG09eM9MCd3+srkplzHMqDlz0AtSPCqUorYzYgIom2u t4MUsCnAagsLBecy3zpKdPVRFZY21VJedSUrjl0BKg+7UecU9h05FcDj5tpLn3VvidCY hLeg== 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:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=v4CYbDgI+ZExVL7Ey3SHDVJYdquQ6nNneks9sNV/1zM=; b=kNSzbgHK8IsCCKRmP5wRCIh2vtwdDdigIpPvsUjrpFVIV0o91GVYrp00f24D+784FU nSQbKj2a3ZXQT/QYLh+JxYXtwFx2ODwhW+rpcFmm82df7TE3Jrhw3w0e/kzgbIxjb2dN dQu8zdsKF4q/oqEFnWSao4IvvEymBntDovfqfy+oWOhXbgX9jjB7j3Cg5YQbCeteR/rp o0DyxArBph2N2fxux1Uzx62PRDeB6aRxu0Vvq2UQJKk7TC7ogk2EkOtUktUD4TBKkezR SlJ3iYm2U2gn/AxqLwifCqAJMUFEcQw0k2cnTJtEBICs7E7BJq+a1mGI9QIv8VecgfAh Rnmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fGAQuYaU; 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 g1si387959ejo.82.2019.09.27.00.11.17; Fri, 27 Sep 2019 00:11:17 -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=fGAQuYaU; 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 S1726429AbfI0HLP (ORCPT + 26 others); Fri, 27 Sep 2019 03:11:15 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:36674 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726376AbfI0HLO (ORCPT ); Fri, 27 Sep 2019 03:11:14 -0400 Received: by mail-pf1-f196.google.com with SMTP id y22so1025087pfr.3 for ; Fri, 27 Sep 2019 00:11:14 -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:in-reply-to:references :in-reply-to:references; bh=v4CYbDgI+ZExVL7Ey3SHDVJYdquQ6nNneks9sNV/1zM=; b=fGAQuYaUuJS0onXta9DcP5iWkDlCdRyhW6e05Srzg1F77NNnN1B8+yp3U3Ne3I2eke 3VznwdYIPtImlztVmwSxvWqx0oVEZ9/fik0CGbbk7JzqXeuS0/aJRlseVEL9V38qbbgr hI7W36dxeFE5xEkU74/b9n1KW+FHDOsMtcCv9vBKX7SWKSQsFd/pJzb0S6bPJ7Jko5Ke F+S+yrbazWCAk2was1TAONqtYf3BZ2Y10J+z2iUDT8FfzKv6D4lyXuVCDlRDkN65qUBi yHFTJpHRHShe2hjBe+uLONkIhf/yP2V2Eequ5BmO+hyexkwSQd22M6KtsRzI7ehL6PQQ ZmnA== 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:in-reply-to:references; bh=v4CYbDgI+ZExVL7Ey3SHDVJYdquQ6nNneks9sNV/1zM=; b=fTf8gExaH997eJzNuGde/v3qb+Y4YEsEsINRZub3rnV+32vEzUy6yyfLR/GoOEF6YI hMzbE1W3VyfOTo4MojULuKQaIGobu7zceqMVUyfsFY5ZOCLOQCzquTKTDYHkXb7L2pXy zhP4s7y37DTOli32iPIYMTo3jQD2TD1DAPO4WUSodhHj12XexKQQFQz0vfbFHhTk3tBN Rxxcvy3+1HONzixgZ64imNFo3I1zxcZhLgmIFFdcCdh9t5Bb2odKzEYMmHUi3rKuWzeq /rmf0d43bJaOh6QsSA1xMMU1xglWop4MddVykQX2zSEL3ibeuT+tv5aYsPSZgCtjoqvA 2A8g== X-Gm-Message-State: APjAAAXNuDkjjH2camuKHa16oTU1Wqb0Ox++63Djn+FYMMOfYQsIJRz9 t5H+xh+i7qygWlnLq0BZY8vDcA== X-Received: by 2002:a17:90b:8d1:: with SMTP id ds17mr8096278pjb.105.1569568274050; Fri, 27 Sep 2019 00:11:14 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id f74sm1733288pfa.34.2019.09.27.00.11.11 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 Sep 2019 00:11:13 -0700 (PDT) From: Baolin Wang To: ohad@wizery.com, bjorn.andersson@linaro.org Cc: orsonzhai@gmail.com, baolin.wang@linaro.org, zhang.lyra@gmail.com, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] hwspinlock: sprd: Change to use devm_platform_ioremap_resource() Date: Fri, 27 Sep 2019 15:10:44 +0800 Message-Id: <00916cd2409a5607fc4023a4cae351f1b2e84d8a.1569567749.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together, which can simpify the code. Signed-off-by: Baolin Wang --- drivers/hwspinlock/sprd_hwspinlock.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 1.7.9.5 diff --git a/drivers/hwspinlock/sprd_hwspinlock.c b/drivers/hwspinlock/sprd_hwspinlock.c index dc42bf5..7a8534f 100644 --- a/drivers/hwspinlock/sprd_hwspinlock.c +++ b/drivers/hwspinlock/sprd_hwspinlock.c @@ -83,7 +83,6 @@ static int sprd_hwspinlock_probe(struct platform_device *pdev) { struct sprd_hwspinlock_dev *sprd_hwlock; struct hwspinlock *lock; - struct resource *res; int i, ret; if (!pdev->dev.of_node) @@ -96,8 +95,7 @@ static int sprd_hwspinlock_probe(struct platform_device *pdev) if (!sprd_hwlock) return -ENOMEM; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - sprd_hwlock->base = devm_ioremap_resource(&pdev->dev, res); + sprd_hwlock->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(sprd_hwlock->base)) return PTR_ERR(sprd_hwlock->base); From patchwork Fri Sep 27 07:10:45 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: 174589 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp3112858ill; Fri, 27 Sep 2019 00:11:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqzDO+cd6DNhNtBf2x17OZi1pPoM6zAtLehsugueMFtJBL/ptE7U+XI/E5QlQeLuYJRL359w X-Received: by 2002:a17:906:20c7:: with SMTP id c7mr6387770ejc.248.1569568283408; Fri, 27 Sep 2019 00:11:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569568283; cv=none; d=google.com; s=arc-20160816; b=xJP2i+jLCV2zi+v7r265SCRrwXuRa5Qve8l9kdhNp6nNyNA4sbh32/HMc2l2+EUzDL wGtDfRZoWhjp5tKi5gcNsKN2g8xewGreOgN6NY5+p6erLIEyhE34vXdDmx1jLnFlM0M8 IFjG+RJ1uWxtkCzW5Ddtv4mAu8SEHaYH3EAhtrs1aa6ifdtvhGjeQKRx6xdQm8TsybgC EenIW8V+SZJIM0at1VH0HFcFpzkNnc1DiPmuA8yx6GQ6Kjk4y8L9a/uFL4kow88lmyFo YfCDI2nSKiBIcHs2aM8Bv27Vq54k5x2guz5CalQ6HfdrhAFmGKUh+0aRxnCAxTYKlPz3 GKfw== 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:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=FgzSnruuv7XNqxxD65EJ+AwZlRv0x29REgnPuXxLMeA=; b=wxPELw4hHwTdqYmDVmsyzKDhvWXyGJE1AwVG2mab8VTUqDy0EcDn8fELhzGF+ZDon2 uls+D/1cAYVFw0vHKwV/SXjJ5XdE6PWdSwj/9UdTR7dQYSZomV7HSc5JIZub3MgEAeZQ zjBCopFbd+ux55jBO/Q8v+69Ja1g0rTj5YdSeGV0uEGU52S+kE8BQd0kWxAuasvnBMSo iSF5iOmGqvIZGD1VJqz+YvEiZ+yiEQRl/v58PCQX3CSkcS7jEkAqEodowVR0fTBjHl2o KYBS1zpXr0iklXdotjUm57Y71d63XjAwsRINEj4dVC9A+FbI65DHWOFIzS/ksbvoUh39 XOfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WrhU2dyi; 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 o32si1028459edc.306.2019.09.27.00.11.23; Fri, 27 Sep 2019 00:11:23 -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=WrhU2dyi; 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 S1726465AbfI0HLT (ORCPT + 26 others); Fri, 27 Sep 2019 03:11:19 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:39825 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726376AbfI0HLS (ORCPT ); Fri, 27 Sep 2019 03:11:18 -0400 Received: by mail-pf1-f196.google.com with SMTP id v4so1015968pff.6 for ; Fri, 27 Sep 2019 00:11:18 -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:in-reply-to:references :in-reply-to:references; bh=FgzSnruuv7XNqxxD65EJ+AwZlRv0x29REgnPuXxLMeA=; b=WrhU2dyi93gFs4D+GbFw4lzLCuOSkkO5QsvfwR5+n6nP+AgAFlLabONZlVnlh1PNPC mlSiTWo6NZ3rzLkqubEFhiB4qFhzx8hgYOTuEZRdzwD2Ssoq3jCc9rh5J4d0pUs/Vojo ra6knN+QFYpr9LsbcUhNaKwIRm1IbfziceIPS1qk7Yt8QG+Y444uD5EHoCQGZFifG0N7 61Y3F6doxu0gP+/SdEt1H9nHBf6LgoXt7jST1l1qRRfdXeyF6hcovCr7P12UbN3CUrsf injvUaBQp/zFbHxOnKMsh+tA8Vtsnwo5902kanTSvzDu05x+7MVABKWjkYwgAyQS3eJU bfFQ== 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:in-reply-to:references; bh=FgzSnruuv7XNqxxD65EJ+AwZlRv0x29REgnPuXxLMeA=; b=pn4ZsEYe1oIcpa8J/rtXAhMtriJUHlisqdmDIf2diE0NK3tofAajb7Bo0UEltcAb96 J/Dq78yUtb24S7AHMwwceRnic8LxVZwvWBSjUDevmUCh+XXknJ03QyqhUlZOG/2YD6yy KeEGRivjBxcndoIThPNJbfojluZWd7vV+SuBBnQAFgSXNGjTDWsI/cNbREOkt4aUymNP M7zEGV3axLp7Rq9qFbxguWt1b9yZApoMreyMYmr+YaOLD0Sy6Fq8s3v4bzxPHyG3S7vd AmN5g0h0bPVv1lfE1mQVY8IXU2TRUFkSkgagjGDsb8nIYKs/gZ1/jtCJFTE1PPp2hJAE QXoA== X-Gm-Message-State: APjAAAVJRC5utC9KXaT6/66nK8dhAGC4IEi7+gXRebUAayAKVcnn1Zi6 AOhZf66+4E3puuNAKgWRDZLs+Xk3yo8oTg== X-Received: by 2002:a63:461e:: with SMTP id t30mr7741315pga.141.1569568277748; Fri, 27 Sep 2019 00:11:17 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id f74sm1733288pfa.34.2019.09.27.00.11.14 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 Sep 2019 00:11:16 -0700 (PDT) From: Baolin Wang To: ohad@wizery.com, bjorn.andersson@linaro.org Cc: orsonzhai@gmail.com, baolin.wang@linaro.org, zhang.lyra@gmail.com, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] hwspinlock: sprd: Check the return value of clk_prepare_enable() Date: Fri, 27 Sep 2019 15:10:45 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We must check the return value of clk_prepare_enable() to make sure the hardware spinlock controller can be enabled successfully, otherwise we should return error. Signed-off-by: Baolin Wang --- drivers/hwspinlock/sprd_hwspinlock.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 1.7.9.5 diff --git a/drivers/hwspinlock/sprd_hwspinlock.c b/drivers/hwspinlock/sprd_hwspinlock.c index 7a8534f..d210424 100644 --- a/drivers/hwspinlock/sprd_hwspinlock.c +++ b/drivers/hwspinlock/sprd_hwspinlock.c @@ -105,7 +105,9 @@ static int sprd_hwspinlock_probe(struct platform_device *pdev) return PTR_ERR(sprd_hwlock->clk); } - clk_prepare_enable(sprd_hwlock->clk); + ret = clk_prepare_enable(sprd_hwlock->clk); + if (ret) + return ret; /* set the hwspinlock to record user id to identify subsystems */ writel(HWSPINLOCK_USER_BITS, sprd_hwlock->base + HWSPINLOCK_RECCTRL); From patchwork Fri Sep 27 07:10:46 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: 174590 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp3112925ill; Fri, 27 Sep 2019 00:11:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqxBADSLeltSXpAotPyZJ4Ajsc6ObAIUW63PqiLHalf+rfJhPr9/7+HhwvLu1a4E8khiU7kT X-Received: by 2002:a17:906:80d9:: with SMTP id a25mr6566364ejx.222.1569568287710; Fri, 27 Sep 2019 00:11:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569568287; cv=none; d=google.com; s=arc-20160816; b=VyTRXt3u8Hqs6EAnK0vSmWWLncGNJvdjUN5JuqP9MDbqAkkynlnviBBoIgokEBEmD0 Do/vZPKRlnaMY17gR3s8o1cqMXjFXPezMDfMddIoPp8PoOgwvlvKEydQe4d4m1yoHEWf tgk331tQGNDZCGrQ2kDezDfaGSWJ45df6iaj9zB260h+HXXSeAK1ek7bMcW/M/csbFue ANK7mXNWTxANZ0DiMd6sm+2vYnBgw3CF/+pcRpk2cNChp8upz7oglENT+WkD6IX92V3q R5laOApUOIp7J0anqwxmcWRy9ZBf5Mo9e08mknCaoTkL3vh0rt2kBKWExsesxcWAiEoV 7nfg== 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:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=rsM2uCT+H5N8frHAhYZ4xNoIMLY0pUKheXJFFZekhJ0=; b=KWxI1TJQS9MP8SbM9PFF2sZLunZL+97Wq0cKHj6VNdOQYOZoDdL2qk8L2jXo3vtZxt rXTFoPDM9a4ZOdHJADYjnXVZaqoTcq4eLueafHORa4tGG9fgr+fPceNNpPopvzZytx+0 p/z6nUYeVV/nFH6bRQ0wIKtI/s2ITl3uXeShKtiJqxZaPX5PtzKiP+nNqVh4C5L65ZQ/ o6z0x9KVHkckvv4f07tVC6WMuyakYxfjCuzdZX+Chj/YYoYqvk0cawcI4QEIMNamsxAb Pq1F6ctyd4Kw4ob0xx9NiJ5lG32aSUUEijTGG9y8YPmB1RITVkk7IzAjP1cUv/HXtQ5Z kUtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VYBbB4IX; 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 t26si945311edd.184.2019.09.27.00.11.27; Fri, 27 Sep 2019 00:11:27 -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=VYBbB4IX; 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 S1726496AbfI0HLX (ORCPT + 26 others); Fri, 27 Sep 2019 03:11:23 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:38380 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726217AbfI0HLX (ORCPT ); Fri, 27 Sep 2019 03:11:23 -0400 Received: by mail-pl1-f193.google.com with SMTP id w8so246085plq.5 for ; Fri, 27 Sep 2019 00:11:21 -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:in-reply-to:references :in-reply-to:references; bh=rsM2uCT+H5N8frHAhYZ4xNoIMLY0pUKheXJFFZekhJ0=; b=VYBbB4IXZbS8pOxmBk6Ioz1/IWOjHl0aTJCwLhy7YY2HHOvVRG5s4W2aVVxmyEKGfX LyxiwbJufXG7RI+4FuFZWzvK5XF6rm9m7oeL04AaxCK21NNiXH0opuZPvcb5XFwiAWmK sP6lF52WGe0e4yA3CKvCLEr1edRWQmh6G5HNcjd54Ybe8LkFTluD2Q/f+yN+BBjgCagH fANqi+yffexA3CyZIHB3U2vWcaBv6auX4VGErkEpk6i8tpYqwhDTlP7m06erEvBbgiq4 05La9Vf5EphZxq1KewIV2zUdaK8dJ37ec3+t+tn1fqSM5+IrOsNV8sD8e1zrpTcdacGG 50PA== 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:in-reply-to:references; bh=rsM2uCT+H5N8frHAhYZ4xNoIMLY0pUKheXJFFZekhJ0=; b=IymKjfmExOdCazxDxX8Vkbgg+LJjoZI8fezioZqZ9sU6p+lriNwDnrJFIvobPvjXHD b865zbwxwRBlyH+RvMhn2kz2GElfksHm0IAzTa3XKY/LhLN9+eVSHhIbihdtMmIGI/f7 TN8s9DvHoiJiepg6X6PzVOuJpjsialkKCAksuHwPlk0mM8VLr5XEQ43FZCYrAvYoO9R+ uQt0wvTmUn7N0xJZzjb78qwjZjwHG3HlhvhFIvvbW+4meSyQWLz5bxetyYvd9pUTzpBw q4/qUnKAGql9vzO8AhqKBSM0/EJ3ov8W99UP9YpHjhxDWppgkcyRfX/ecTLC93xsgM6I 6Apw== X-Gm-Message-State: APjAAAWXt0BEeqhYb97dAMszSQaGewOBH1q3/F1r8/+gzdgO88+sbl94 XaWRRjel2mfEcJKD4eqrCP4gPQ== X-Received: by 2002:a17:902:7886:: with SMTP id q6mr3030571pll.323.1569568281015; Fri, 27 Sep 2019 00:11:21 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id f74sm1733288pfa.34.2019.09.27.00.11.18 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 Sep 2019 00:11:20 -0700 (PDT) From: Baolin Wang To: ohad@wizery.com, bjorn.andersson@linaro.org Cc: orsonzhai@gmail.com, baolin.wang@linaro.org, zhang.lyra@gmail.com, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] hwspinlock: sprd: Use devm_add_action_or_reset() for calls to clk_disable_unprepare() Date: Fri, 27 Sep 2019 15:10:46 +0800 Message-Id: <03de1c267461a6ac17cf7732404795b2fe735927.1569567749.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use devm_add_action_or_reset() for calls to clk_disable_unprepare(), which can simplify the error handling. Signed-off-by: Baolin Wang --- drivers/hwspinlock/sprd_hwspinlock.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) -- 1.7.9.5 diff --git a/drivers/hwspinlock/sprd_hwspinlock.c b/drivers/hwspinlock/sprd_hwspinlock.c index d210424..e76c702 100644 --- a/drivers/hwspinlock/sprd_hwspinlock.c +++ b/drivers/hwspinlock/sprd_hwspinlock.c @@ -79,6 +79,13 @@ static void sprd_hwspinlock_relax(struct hwspinlock *lock) .relax = sprd_hwspinlock_relax, }; +static void sprd_hwspinlock_disable(void *data) +{ + struct sprd_hwspinlock_dev *sprd_hwlock = data; + + clk_disable_unprepare(sprd_hwlock->clk); +} + static int sprd_hwspinlock_probe(struct platform_device *pdev) { struct sprd_hwspinlock_dev *sprd_hwlock; @@ -109,6 +116,14 @@ static int sprd_hwspinlock_probe(struct platform_device *pdev) if (ret) return ret; + ret = devm_add_action_or_reset(&pdev->dev, sprd_hwspinlock_disable, + sprd_hwlock); + if (ret) { + dev_err(&pdev->dev, + "Failed to add hwspinlock disable action\n"); + return ret; + } + /* set the hwspinlock to record user id to identify subsystems */ writel(HWSPINLOCK_USER_BITS, sprd_hwlock->base + HWSPINLOCK_RECCTRL); @@ -124,7 +139,6 @@ static int sprd_hwspinlock_probe(struct platform_device *pdev) &sprd_hwspinlock_ops, 0, SPRD_HWLOCKS_NUM); if (ret) { pm_runtime_disable(&pdev->dev); - clk_disable_unprepare(sprd_hwlock->clk); return ret; } @@ -137,7 +151,6 @@ static int sprd_hwspinlock_remove(struct platform_device *pdev) hwspin_lock_unregister(&sprd_hwlock->bank); pm_runtime_disable(&pdev->dev); - clk_disable_unprepare(sprd_hwlock->clk); return 0; } From patchwork Fri Sep 27 07:10:47 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: 174591 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp3112940ill; Fri, 27 Sep 2019 00:11:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqzF3uzTTcSjKd2VlgqDsbTSaOvTP09MrRcTJCTYuvAZUZ1KB7gL3sIMFoa7G+zD1bQ4+AbG X-Received: by 2002:a17:906:6c98:: with SMTP id s24mr6370108ejr.28.1569568288572; Fri, 27 Sep 2019 00:11:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569568288; cv=none; d=google.com; s=arc-20160816; b=lRX9gwAJWcupkGUMu6uL16TxBUGhpxkHMoWPp6yjsHT9R6B8tA+ZiR054q7q8ulRYB wRmND8Q0Tn43jKhno9tm3ZWNblqml7BpciX/g5riGWMaqxCD0w3cfYz2ZHZAN6eomQFs FJEpXuck+V8oAt3VtF+I0E3xDEI9MRM5JgYcY9AnyjXATtlDXxmt3aeAHLTJR0Wp9O7V ngTfaXArTyMP4VUIHnP8ZImBCKLOvoE/mh2awVcaB/YdaPYhdEUlkyvi2gP3NWF9eLlR WuMa9sI+lOwO7JBKEj29Yoem7QoztSOuRycKUXRudC3FqbY7Ez5lykXXs40MZyU0KRts ANzA== 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:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=JWJl6+k678lNhoIwgPT24JSdOgdcYLv3dPpKZNuhawQ=; b=Eq8i7ic77A8y80pJDNVSCLz/96JT7lORPh/QdItzo60/icYNnoDLeGH2nXkWQPwAdW nhLHc9/EEl8kcYGgduqpUtBSO3vubzkX9uplUcvv51xxFDvcszXLeZTPdoLftF5fpTyQ /wS1V55CwggPmBYklj5CdK4hICkawZXTFW8JAQw01MxP2WG65C9ZyEjwY3NaYNFQNE0q fTqUJR/lkBCwp9cZbmUbVwfqek7U7OU6uCzefP2H5tUpEQjHqbhd1oJ/QwrHH6+oIsph ry4xNTXaBe2VpsyaOxWq0nPlYV0xco9RKwYA+qEX78+RR24+DMZ+4cjNb8f/i2JTOH8F wDZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e8jqNvEb; 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 t26si945311edd.184.2019.09.27.00.11.28; Fri, 27 Sep 2019 00:11:28 -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=e8jqNvEb; 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 S1726584AbfI0HL0 (ORCPT + 26 others); Fri, 27 Sep 2019 03:11:26 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:41294 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726498AbfI0HLY (ORCPT ); Fri, 27 Sep 2019 03:11:24 -0400 Received: by mail-pl1-f193.google.com with SMTP id t10so702142plr.8 for ; Fri, 27 Sep 2019 00:11:24 -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:in-reply-to:references :in-reply-to:references; bh=JWJl6+k678lNhoIwgPT24JSdOgdcYLv3dPpKZNuhawQ=; b=e8jqNvEbhvr0kgtsFK625isW2I3jDhZSNomDeSga2oSYqTtT6RV+dW3pDm6Z3HXJ+9 VwZc7ZzddAyp7VGQZ+t1szym8TCRuLxnvAT0WHpHyEZCyeekVFH/IFh3d9QbSVCzMEGW LTiZ1DuLVoVKGGC7tfWmtZc3H06WK4Fq36Dnt0ef98J49H8bvgehZ3rjL8hJuVE6F6Nh zA7Kj0j0nGE7B4kkI0By8EjHSSIp5pz9GqxNXTd2OKQbEQNO0XjYZ2Abcu2K2Ma1Mjf5 fPo05WdTHPdOW4PC3PX+pawyJZq6F9nXCfhckU7KfbjS+u5Dg3A1+e//XI4nKGUYJn8L ZbAA== 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:in-reply-to:references; bh=JWJl6+k678lNhoIwgPT24JSdOgdcYLv3dPpKZNuhawQ=; b=XH7PSA6k5ooPenyFRTVpy5aDMKkEp7jTSK02AJAILiUcCrQkh4yf3XILoJ4hE75zh8 5UlDV05bIQpWyh/C8wqdGiiZg50cYVdcchxYI0zveDXMH/XiE8MYqmqMF4E/tp4R9pHi Bx1EhrpWjx3l/hnxIxQiUr1ONZ9HB7uAYR+gZNPLx+At3u0/EKwndKKiKzno2FvlQRVK M+XQfmmhMEPV+mefdhT61xiUMisgIMxIM/GfQpiQ3/IovECjUY+jpktkCct4Q9n5WCKv zZTMjfzV3DMvqRy3NGU2qcJmvmAweFeySzlwgdpg9rYFEdR/TRBzaeFpfRIsWc4eSUAH Jynw== X-Gm-Message-State: APjAAAVGPkoagDxXtwv8SJrWI7Whv7QyDf/G+9oIGuTz9aRJ7l8dk48g lCYirPiVMccqHZpuLO1QwoiPGQ== X-Received: by 2002:a17:902:9346:: with SMTP id g6mr3045391plp.0.1569568284057; Fri, 27 Sep 2019 00:11:24 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id f74sm1733288pfa.34.2019.09.27.00.11.21 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 Sep 2019 00:11:23 -0700 (PDT) From: Baolin Wang To: ohad@wizery.com, bjorn.andersson@linaro.org Cc: orsonzhai@gmail.com, baolin.wang@linaro.org, zhang.lyra@gmail.com, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] hwspinlock: sprd: Use devm_hwspin_lock_register() to register hwlock controller Date: Fri, 27 Sep 2019 15:10:47 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use devm_hwspin_lock_register() to register the hwlock controller instead of unregistering the hwlock controller explicitly when removing the device. Signed-off-by: Baolin Wang --- drivers/hwspinlock/sprd_hwspinlock.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) -- 1.7.9.5 diff --git a/drivers/hwspinlock/sprd_hwspinlock.c b/drivers/hwspinlock/sprd_hwspinlock.c index e76c702..44d69db 100644 --- a/drivers/hwspinlock/sprd_hwspinlock.c +++ b/drivers/hwspinlock/sprd_hwspinlock.c @@ -135,8 +135,9 @@ static int sprd_hwspinlock_probe(struct platform_device *pdev) platform_set_drvdata(pdev, sprd_hwlock); pm_runtime_enable(&pdev->dev); - ret = hwspin_lock_register(&sprd_hwlock->bank, &pdev->dev, - &sprd_hwspinlock_ops, 0, SPRD_HWLOCKS_NUM); + ret = devm_hwspin_lock_register(&pdev->dev, &sprd_hwlock->bank, + &sprd_hwspinlock_ops, 0, + SPRD_HWLOCKS_NUM); if (ret) { pm_runtime_disable(&pdev->dev); return ret; @@ -147,9 +148,6 @@ static int sprd_hwspinlock_probe(struct platform_device *pdev) static int sprd_hwspinlock_remove(struct platform_device *pdev) { - struct sprd_hwspinlock_dev *sprd_hwlock = platform_get_drvdata(pdev); - - hwspin_lock_unregister(&sprd_hwlock->bank); pm_runtime_disable(&pdev->dev); return 0; }