Received: by 10.192.165.148 with SMTP id m20csp4395254imm; Tue, 8 May 2018 07:50:24 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrrpH/FX9GcF5yu0CubJW8bsP+n5udK0Rvbulhe0qZf2M+0ATvMA24+/GZS5QRzJrg/QjWL X-Received: by 2002:a17:902:5597:: with SMTP id g23-v6mr41976160pli.347.1525791024731; Tue, 08 May 2018 07:50:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525791024; cv=none; d=google.com; s=arc-20160816; b=f6W/D7EwZNq7zKZkRUIRQmBAFM1eb42ed6gQKtbSV/nUsi5qTZk6At2qE8eX2ninwK z9nwunaBAd3TkPWItRnlc5GzT+8kAyXqwDHF19dmprt/J45X46qJAnd0hUgHcm/9QZT+ 0bmpUV41UBbAe8pgYAGAw9oWEAMLeRAo4y1uD/zrRIvaE4h7bD01o11TQ1ue0nX0TSJF h8surSSkoXh1TzlLc8lwjLS88pq0ttC8Y39n5haX1tb5YMkl5JllTD/h73YxpJfyxzEi ilPNhjSar9LREopyW4hbM7g+XjALP4srnWcR9Xdv/8D059BUhVjkExG17dYMHBSVn2+L vtLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=bQ1d9yYckgdmHQinuOOj5gIGenzy96wUBfzhgYuvu1k=; b=rfma5FrDFOJXxOhKxmtrwwy/1E6HBpBenEt70Hg+HWVVpCec1jT8j/7Mc0iF64tsTb r6CkDDCaaqt+IQoCwqU127e8tn67n2B9vP4N5Bzf7/1UyadurolrRGRMfT+a29pdR8mu XQbAz3Gqsf1vBvze7eTl+TvWAxsgdcGPW1xb9Dmtu/R9o1KopRIet5JHt62Apx4L/ft3 8wmCg2oCv0egAL6y0kAOjbdwJegTxpJCznHXvJZteZJWwoer2NB7ijxxYIKeoa+/xdk1 toRZZoWgELg5x8TvZyvaCMi0SrJibVEKH+oQnVR1MMDuthCa6GwGSiLpCbvxCuSRXLu+ fVFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@roeck-us.net header.s=default header.b=AudjJlzs; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x3-v6si23957692plb.478.2018.05.08.07.50.10; Tue, 08 May 2018 07:50:24 -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=fail header.i=@roeck-us.net header.s=default header.b=AudjJlzs; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932764AbeEHOsc (ORCPT + 99 others); Tue, 8 May 2018 10:48:32 -0400 Received: from bh-25.webhostbox.net ([208.91.199.152]:51826 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932659AbeEHOsa (ORCPT ); Tue, 8 May 2018 10:48:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=roeck-us.net; s=default; h=In-Reply-To:Content-Type:MIME-Version:References :Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding :Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=bQ1d9yYckgdmHQinuOOj5gIGenzy96wUBfzhgYuvu1k=; b=AudjJlzskM7w9De/2Pf0EzDjR/ SjHnRI5M5rONFhwPejqB63E8emOD4dtCoaPz76d3Di3m82ygJvDv2Hn1/8Tf+JBbu+0AY8Ib66RWP 8nH5+fhdc7Ds2pJ90eVkjb+7FQKbyBT2i3knhEfm3g/dltSjLUtR+eaNX5PHKDDQzSp11O18dljjf yAJQa3+3X39DTYjs99JEHqpBTxuCdaKBmGGM6f6nP4y8khfnlH5AqTvZm6+4Q+3SzOEx+LlqQn7DZ qeN48gtdBDEFULbnNzDO3yZ3k84ujlnRmmChBvI1OSMeNoJrP8fnPR5dqdKvJVOjinH1hV9RsY1z0 ug8MqSRA==; Received: from 108-223-40-66.lightspeed.sntcca.sbcglobal.net ([108.223.40.66]:49784 helo=localhost) by bh-25.webhostbox.net with esmtpa (Exim 4.89) (envelope-from ) id 1fG3uh-001FDK-8X; Tue, 08 May 2018 14:48:24 +0000 Date: Tue, 8 May 2018 07:48:22 -0700 From: Guenter Roeck To: Jia-Ju Bai Cc: morbidrsa@gmail.com, wim@linux-watchdog.org, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] watchdog: mena21_wdt: Drop unnecessary mutex lock Message-ID: <20180508144822.GA11268@roeck-us.net> References: <20180508071206.13375-1-baijiaju1990@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180508071206.13375-1-baijiaju1990@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Authenticated_sender: guenter@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: guenter@roeck-us.net X-Authenticated-Sender: bh-25.webhostbox.net: guenter@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 08, 2018 at 03:12:06PM +0800, Jia-Ju Bai wrote: > There is already a mutex in the watchdog core which serializes > calls to the various API functions. > So the mutex lock "drv->lock" is unnecessary and can be dropped. > > Signed-off-by: Jia-Ju Bai Reviewed-by: Guenter Roeck > --- > drivers/watchdog/mena21_wdt.c | 18 ------------------ > 1 file changed, 18 deletions(-) > > diff --git a/drivers/watchdog/mena21_wdt.c b/drivers/watchdog/mena21_wdt.c > index 25d5d2b8cfbe..0be7f50e8ff9 100644 > --- a/drivers/watchdog/mena21_wdt.c > +++ b/drivers/watchdog/mena21_wdt.c > @@ -31,7 +31,6 @@ enum a21_wdt_gpios { > > struct a21_wdt_drv { > struct watchdog_device wdt; > - struct mutex lock; > unsigned gpios[NUM_GPIOS]; > }; > > @@ -55,12 +54,8 @@ static int a21_wdt_start(struct watchdog_device *wdt) > { > struct a21_wdt_drv *drv = watchdog_get_drvdata(wdt); > > - mutex_lock(&drv->lock); > - > gpio_set_value(drv->gpios[GPIO_WD_ENAB], 1); > > - mutex_unlock(&drv->lock); > - > return 0; > } > > @@ -68,12 +63,8 @@ static int a21_wdt_stop(struct watchdog_device *wdt) > { > struct a21_wdt_drv *drv = watchdog_get_drvdata(wdt); > > - mutex_lock(&drv->lock); > - > gpio_set_value(drv->gpios[GPIO_WD_ENAB], 0); > > - mutex_unlock(&drv->lock); > - > return 0; > } > > @@ -81,14 +72,10 @@ static int a21_wdt_ping(struct watchdog_device *wdt) > { > struct a21_wdt_drv *drv = watchdog_get_drvdata(wdt); > > - mutex_lock(&drv->lock); > - > gpio_set_value(drv->gpios[GPIO_WD_TRIG], 0); > ndelay(10); > gpio_set_value(drv->gpios[GPIO_WD_TRIG], 1); > > - mutex_unlock(&drv->lock); > - > return 0; > } > > @@ -108,8 +95,6 @@ static int a21_wdt_set_timeout(struct watchdog_device *wdt, > return -EINVAL; > } > > - mutex_lock(&drv->lock); > - > if (timeout == 1) > gpio_set_value(drv->gpios[GPIO_WD_FAST], 1); > else > @@ -117,8 +102,6 @@ static int a21_wdt_set_timeout(struct watchdog_device *wdt, > > wdt->timeout = timeout; > > - mutex_unlock(&drv->lock); > - > return 0; > } > > @@ -191,7 +174,6 @@ static int a21_wdt_probe(struct platform_device *pdev) > return ret; > } > > - mutex_init(&drv->lock); > watchdog_init_timeout(&a21_wdt, 30, &pdev->dev); > watchdog_set_nowayout(&a21_wdt, nowayout); > watchdog_set_drvdata(&a21_wdt, drv); > -- > 2.17.0 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html