Received: by 10.192.165.148 with SMTP id m20csp3971349imm; Tue, 8 May 2018 00:12:40 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp1W5CnToQ1j5CblOgYBVjgX4IXxOhy99ZrsKto1LyxSOq4pcRQLUjCWyCdthBQEZEpxnBH X-Received: by 10.98.217.5 with SMTP id s5mr39366450pfg.20.1525763560872; Tue, 08 May 2018 00:12:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525763560; cv=none; d=google.com; s=arc-20160816; b=WSY7B2IQu0VPW1uVRkMX09hA70Ui5bLuXvi/o6DZ6hTEd1lov4724Jj2iM7fkZ4W+4 X2J1Fv0lElw9k6g0KoxAl2PMc6FNxBxhXoMcyn36IGoPI3aLArMvGAt5eehDzi3zxBDT uKvC1luSrTkwreE+G7vRT3YeMRtl9BQzma54vbikCGxHTJxmnGHR4BjPzqxYcjk5k963 gBmHn1NPntcGIz5fvISsl7eO0WS6OZNIMe7DEZFZeFYM75ZzK803GRJaeTt/A0bE8HQR pleNmRm5HZFVYttzbE8/J3tDv+VR9BYGtXMeU0ml8sHWA7hHve2lZQDAryBB15j1cAsG tbyA== 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:arc-authentication-results; bh=X+kJ0G5OUKh2CVn+HKcPAWnA1XmUXzZV5Y0xVadDSC0=; b=aLAF/y37Cv/3U0RxkdIKu/2bSP+lF8jgsozPn/wF0qHDlPDH2I9qWIw8HWX5nCJ34m 6Zh0w8/lZYge7m6IDlKwS7oTE4Rvz8tNq7yMUF5CxQLJVQkp4TbodfcJ8hj2DySNlU+o avsCZsbPbWGn3DD/YbJqEu6gzIyHJpD//vJCKp0K7yZ8XeZHcCOwOPrm9kTPcZc9IEL2 u/KUT7JdREbbfMl8sUBxeFjdSdkaVGx7S05EN9j5FvALhBWA3KnvBdWun3ILbEj4K+nT qX06SuiSofXA2Kr8ZxapxFq7ocMrd+N18GgBw9Pv2HYnErWKdyinUBf7U8iVnD3fHlRc XGWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GkjfNBsw; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v12-v6si24029322plz.33.2018.05.08.00.12.26; Tue, 08 May 2018 00:12:40 -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=@gmail.com header.s=20161025 header.b=GkjfNBsw; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754571AbeEHHMQ (ORCPT + 99 others); Tue, 8 May 2018 03:12:16 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:46955 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754492AbeEHHMP (ORCPT ); Tue, 8 May 2018 03:12:15 -0400 Received: by mail-pg0-f67.google.com with SMTP id z4-v6so20753284pgu.13; Tue, 08 May 2018 00:12:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=X+kJ0G5OUKh2CVn+HKcPAWnA1XmUXzZV5Y0xVadDSC0=; b=GkjfNBswga6pqY0jIKDVlMqqJFxV/dHnYX++Pzs7vtL3gbAvp6/eRcT3LCUBx/5i5u zdy+yc49PMITQ2UkeJpH1dt9q89KUkSJmr3oADWmGxhIz+Rr8XHCw5JSRJ0r94F/KB5O WRZ0aOJxyqiwwJej7+MoxJxitLYKXCxe0OVIiPsxFM41Iev3diZIsM2jckqpao64XBSb N7m8gP7U/UZHmYWUZXCTYO7YTF7Lw6qrrsFqQLPvzh38z5oW2/RF2mXXTdhWsBxnrsJj xfTnEMI+kdbY7kpD8aJaYUBu9RbSo+sVs/T1lu1NXxaq4lOQiTc2TDPMXgjrNS3LZLOX gezw== 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=X+kJ0G5OUKh2CVn+HKcPAWnA1XmUXzZV5Y0xVadDSC0=; b=taSnf29v3GoVjLGciIWXAULcmj52NwDkpevLisJ5ELyI/vNvyd2VMTrT/cKa9wKs/I WdAAjnCGrPBhVxXQSh1LwEsUJfhc5pkhSvMX4U/4Uly/sTylHvXOF3uIEgginkg++HOO MzdHFTgI0iYmUx79mxdaXkkRRjcQ9O8yJI3p2BY1DkduP8g+jp7rLwghTUpu64MTf15+ L2Yd6V9bKrAadL3yEGBvXq0ibTsEg1rYHIgD3CK7sZIl1nO4SpkaM3FPCZMj7LkX3XFr 8P8Y/mU3xeelgQLdGxx9mYhvQrp6bwwhk7FYhhGn4BgcOJN8dKqllsSNQg7mCs5TH25y hj8w== X-Gm-Message-State: ALQs6tD4ScoJcZjXeGMTTZy+Ltq98ouYratj/K6csMoasMkxyUthV9xI 6HBBYv6lwhH2TzJlbP8s5pc= X-Received: by 2002:a63:7341:: with SMTP id d1-v6mr31274318pgn.404.1525763534626; Tue, 08 May 2018 00:12:14 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:18bf:4b0b:7f52:49b]) by smtp.gmail.com with ESMTPSA id l90sm52036080pfb.149.2018.05.08.00.12.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 00:12:14 -0700 (PDT) From: Jia-Ju Bai To: morbidrsa@gmail.com, wim@linux-watchdog.org, linux@roeck-us.net Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] watchdog: mena21_wdt: Drop unnecessary mutex lock Date: Tue, 8 May 2018 15:12:06 +0800 Message-Id: <20180508071206.13375-1-baijiaju1990@gmail.com> X-Mailer: git-send-email 2.17.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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