From patchwork Fri Apr 11 22:19:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 3972381 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BD776BFF02 for ; Fri, 11 Apr 2014 22:52:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 050332034A for ; Fri, 11 Apr 2014 22:52:27 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 287AD202FE for ; Fri, 11 Apr 2014 22:52:26 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WYkFQ-000371-Hs; Fri, 11 Apr 2014 22:48:36 +0000 Received: from mail-pa0-f74.google.com ([209.85.220.74]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WYkFO-00031n-5W for linux-arm-kernel@lists.infradead.org; Fri, 11 Apr 2014 22:48:34 +0000 Received: by mail-pa0-f74.google.com with SMTP id fb1so777306pad.5 for ; Fri, 11 Apr 2014 15:48:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=fL+i3RUC5y+f5tHe5Jn4BDN0FfI3tmGuRQyvs3u3oOo=; b=A4+bE77jmDcBWDTB7xvddWNXdm7aaw7BPKc1o7RsqEo/QmSFvrBqlSe5IKUnrKuBR2 E6dTG3+9tI1CJPkOea5uTPo6ElFDKSnb7Kw94q6oe8Y4fyxn3bKFVTXQ4EammAtsZ6vd taOLW3+MptUm41e/980IzXPYxNY4Bj9ed5R3n5zuXmhN5V2cQ2maT1H3W4w9LA4BTKBt 3CYvvqeKfd26DhGir7xLEgI60vyNUsbaG5lw0mT9fEYrBtnHwvX9G58rdKLqU9AxBBmj OKodjiDh+8nr8onogHnsR/NrcBsxbQU2qhKEGC0gaNIBHh3e5mEaj1HKOFnhhlXokMUs N0Pw== X-Gm-Message-State: ALoCoQm5Xv11LszAbKPJRnCFlrFMl8Fc+mNk6aRRJUZ0Gde1B/MyDEtVVo/bTwy+OcPsbMlLXtHNACQin+o/Wbk92UoCrdNf/6pD8SM+skARAm+JE6mDlxieSoDjctOSPgugqJegO/CSVOp8/PDHZ8xFcFkItSUYSsOmCniR+szLCcNyhah6fQbB6aCClXnBKW+/CTldi6yeN8EEmbSdEo3BjaApxYkPbA== X-Received: by 10.66.173.75 with SMTP id bi11mr13530258pac.4.1397255012460; Fri, 11 Apr 2014 15:23:32 -0700 (PDT) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id r61si1331338yhf.1.2014.04.11.15.23.32 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 11 Apr 2014 15:23:32 -0700 (PDT) Received: from tictac.mtv.corp.google.com (tictac.mtv.corp.google.com [172.22.72.141]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id 4085931C1C7; Fri, 11 Apr 2014 15:23:32 -0700 (PDT) Received: by tictac.mtv.corp.google.com (Postfix, from userid 121310) id DB28F806D7; Fri, 11 Apr 2014 15:23:31 -0700 (PDT) From: Doug Anderson To: Wolfram Sang Subject: [PATCH] i2c: s3c2410: resume race fix Date: Fri, 11 Apr 2014 15:19:41 -0700 Message-Id: <1397254781-23833-1-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 1.9.1.423.g4596e3a X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140411_154834_224349_A576B3A6 X-CRM114-Status: GOOD ( 11.97 ) X-Spam-Score: -1.1 (-) Cc: linux-samsung-soc@vger.kernel.org, Doug Anderson , linux-kernel@vger.kernel.org, Kukjin Kim , linux-i2c@vger.kernel.org, Ben Dooks , Olof Johansson , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Olof Johansson Don't unmark the device as suspended until after it's been re-setup. The main race would be w.r.t. an i2c driver that gets resumed at the same time (asyncronously), that is allowed to do a transfer since suspended is set to 0 before reinit, but really should have seen the -EIO return instead. Signed-off-by: Olof Johansson Signed-off-by: Doug Anderson Acked-by: Kukjin Kim --- drivers/i2c/busses/i2c-s3c2410.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index ae44910..bb3a996 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c @@ -1276,10 +1276,10 @@ static int s3c24xx_i2c_resume(struct device *dev) struct platform_device *pdev = to_platform_device(dev); struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev); - i2c->suspended = 0; clk_prepare_enable(i2c->clk); s3c24xx_i2c_init(i2c); clk_disable_unprepare(i2c->clk); + i2c->suspended = 0; return 0; }