From patchwork Wed Nov 7 10:28:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Krishna Chatradhi X-Patchwork-Id: 1709681 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 8C420DFB7A for ; Wed, 7 Nov 2012 10:32:34 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TW2th-0004TZ-3z; Wed, 07 Nov 2012 10:30:13 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TW2tc-0004TB-8W for linux-arm-kernel@lists.infradead.org; Wed, 07 Nov 2012 10:30:10 +0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MD4002B6560B4Q0@mailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 07 Nov 2012 19:30:03 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.126]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id D5.09.01231.B283A905; Wed, 07 Nov 2012 19:30:03 +0900 (KST) X-AuditID: cbfee61a-b7fa66d0000004cf-e3-509a382b2774 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 45.09.01231.B283A905; Wed, 07 Nov 2012 19:30:03 +0900 (KST) Received: from naveen-linux.sisodomain.com ([107.108.83.161]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MD4005XV53G4590@mmp2.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 07 Nov 2012 19:30:03 +0900 (KST) From: Naveen Krishna Chatradhi To: linux-i2c@vger.kernel.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH] i2c: samsung: resume race fix Date: Wed, 07 Nov 2012 15:58:26 +0530 Message-id: <1352284106-24988-1-git-send-email-ch.naveen@samsung.com> X-Mailer: git-send-email 1.7.9.5 DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrELMWRmVeSWpSXmKPExsWyRsSkTlfbYlaAwbR5yhabHl9jdWD02Lyk PoAxissmJTUnsyy1SN8ugStjxr4nbAV7OCqm/D3B0sDYxd7FyMkhIWAicfPORShbTOLCvfVs XYxcHEICSxkldmy4ywpTdK/7PQtEYjqjxJkjb5kgnK1MErsutoO1swmYSRxctBrMFhFwkOje doQdpIhZYBajxLTdM4HaOTiEBfQkOn8Vg9SwCKhKtO7oZAIJ8wq4SnzbbQJiSggoSMyZZANR ISDxbfIhFoiwrMSmA8wgAyUE9rBJfJkwEeo2SYmDK26wTGAUXMDIsIpRNLUguaA4KT3XUK84 Mbe4NC9dLzk/dxMjMKBO/3smtYNxZYPFIUYBDkYlHt4J6TMDhFgTy4orcw8xSnAwK4nwLjea FSDEm5JYWZValB9fVJqTWnyI0QfokonMUqLJ+cBgzyuJNzQ2MTc1NrU0MjIzNcUhrCTO2+yR EiAkkJ5YkpqdmlqQWgQzjomDU6qBsX3OqwLOlollR9JfR0yv/XInXdHzvEBNZbeEIWfjMp/M J6t8OZmiDf5ZJJ6fYDpphVKfas6zZ+wPJn8MWnr36bPdjq/eK1o+8S5XSW6yXlfeNim0f9WV w5xX+fZcf1v3qz6TbVPU/Z3pAvutcxpv7sub5rd01h+WO62mmvP+3Ov7e4lJJbpkvxJLcUai oRZzUXEiAM5XHoZVAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrILMWRmVeSWpSXmKPExsVy+t9jQV1ti1kBBreeSFhsenyN1YHRY/OS +gDGqAZGm4zUxJTUIoXUvOT8lMy8dFsl7+B453hTMwNDXUNLC3MlhbzE3FRbJRefAF23zByg qUoKZYk5pUChgMTiYiV9O0wTQkPcdC1gGiN0fUOC4HqMDNBAwhrGjBn7nrAV7OGomPL3BEsD Yxd7FyMnh4SAicS97vcsELaYxIV769m6GLk4hASmM0qcOfKWCcLZyiSx62I7WAebgJnEwUWr wWwRAQeJ7m1H2EGKmAVmMUpM2z0TaBQHh7CAnkTnr2KQGhYBVYnWHZ1MIGFeAVeJb7tNQEwJ AQWJOZNsJjByL2BkWMUomlqQXFCclJ5rqFecmFtcmpeul5yfu4kRHK7PpHYwrmywOMQowMGo xMM7IX1mgBBrYllxZe4hRgkOZiUR3uVGswKEeFMSK6tSi/Lji0pzUosPMfoA7Z7ILCWanA+M pbySeENjE3NTY1NLEwsTM0scwkrivM0eKQFCAumJJanZqakFqUUw45g4OKUaGDd2/foZ4iUe Ee3Wz3Xjyar5l2c/kLt4tmCx5NFNPI4PZ61WLeawDdMurAp5M+cn5yT2OS3pvBt7J3GbsLby b99Rt+Po7p7j93YUfJNStk6IvfMgWO56Tku8YcFMzbeLNN/+5jqdu2hDqe2iPfbbYny3BSQq 3VeY3fvqJ0fTMSeXOXOEbN91/VFiKc5INNRiLipOBACzYQ6ihAIAAA== X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121107_053008_648287_F268D4CE X-CRM114-Status: GOOD ( 11.14 ) X-Spam-Score: -7.5 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [203.254.224.34 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 HDRS_LCASE Odd capitalization of message header Cc: w.sang@pengutronix.de, ben-linux@fluff.org, khali@linux-fr.org, naveenkrishna.ch@gmail.com, olofj@chromium.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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: Naveen Krishna Chatradhi Acked-by: Jean Delvare --- 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 3e0335f..dbaf920 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c @@ -1134,10 +1134,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; }