From patchwork Wed Dec 5 00:59:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jingoo Han X-Patchwork-Id: 1839861 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 1983B3FCA5 for ; Wed, 5 Dec 2012 01:01:55 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Tg3KW-0002NN-Du; Wed, 05 Dec 2012 00:59:16 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Tg3KR-0002Mp-WB for linux-arm-kernel@lists.infradead.org; Wed, 05 Dec 2012 00:59:14 +0000 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MEJ0079X9EGA860@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 05 Dec 2012 09:59:08 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.49]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 7F.C5.12699.C5C9EB05; Wed, 05 Dec 2012 09:59:08 +0900 (KST) X-AuditID: cbfee61b-b7f616d00000319b-32-50be9c5cf7cc Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id EE.C5.12699.C5C9EB05; Wed, 05 Dec 2012 09:59:08 +0900 (KST) Received: from DOJG1HAN02 ([12.23.120.99]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MEJ00MBR9EJVE40@mmp2.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 05 Dec 2012 09:59:08 +0900 (KST) From: Jingoo Han To: 'Andrew Morton' , 'LKML' Subject: [PATCH v4] backlight: corgi_lcd: Use gpio_set_value_cansleep() to avoid WARN_ON Date: Wed, 05 Dec 2012 09:59:07 +0900 Message-id: <000201cdd283$baf50160$30df0420$%han@samsung.com> MIME-version: 1.0 X-Mailer: Microsoft Office Outlook 12.0 Thread-index: Ac3Sg7qDkEV3VJbdT9OePeZe/2bfkw== Content-language: ko DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrLIsWRmVeSWpSXmKPExsVy+t8zQ92YOfsCDFb9VbHY9PgaqwOjx+Yl 9QGMUVw2Kak5mWWpRfp2CVwZm+/qFWxVrmi//46tgXGtfBcjJ4eEgInEq99bWCBsMYkL99az dTFycQgJLGOU2HB2KVMXIwdY0e0NiRDx6YwSy+d8ZwVpEBJYzCTROS0SxGYTUJP48uUwO4gt IhAh0TxjFjNIA7NAI5PE6wXzwBqEBaIkXj28wAhiswioSqw6egjM5hWwlXg+/x4ThC0o8WPy PbCLmAW0JDZva2KFsOUlNq95ywxxkLrEo7+6ELv0JI5ee8gGUSIise/FO6jxAhLfJh9igSiX ldh0AOwcCYF2dolv79vZIR6WlDi44gbLBEaxWUg2z0KyeRaSzbOQrFjAyLKKUTS1ILmgOCk9 10ivODG3uDQvXS85P3cTIyROpHcwrmqwOMQowMGoxMMrYbwvQIg1say4MvcQowQHs5II7z87 oBBvSmJlVWpRfnxRaU5q8SFGH6DLJzJLiSbnA2M4ryTe0NjYxMzE1MTc0tTcFIewkjhvs0dK gJBAemJJanZqakFqEcw4Jg5OqQbGXMGpH69M+TRNPVckckmKQ9Unm8KFfGp7xJvmhoTud5rN MEdWWfDXtKbNU4/1r3HmvPbwwNY9f4sVmL8HK9nmy71MldRkN5Ng+ui6/3yb6areD/2uuxhW Td+bnX198ZuYXSZZNWsvv9ojUJLMrMxQ+N/nBMMrHtknSQ8cDnwT4vstVRcW0X9ZiaU4I9FQ i7moOBEAjFztO8ACAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrDIsWRmVeSWpSXmKPExsVy+t9jQd2YOfsCDPp3yVlsenyN1YHRY/OS +gDGqAZGm4zUxJTUIoXUvOT8lMy8dFsl7+B453hTMwNDXUNLC3MlhbzE3FRbJRefAF23zByg qUoKZYk5pUChgMTiYiV9O0wTQkPcdC1gGiN0fUOC4HqMDNBAwjrGjM139Qq2Kle033/H1sC4 Vr6LkYNDQsBE4vaGxC5GTiBTTOLCvfVsXYxcHEIC0xklls/5zgqSEBJYzCTROS0SxGYTUJP4 8uUwO4gtIhAh0TxjFjNIA7NAI5PE6wXzwBqEBaIkXj28wAhiswioSqw6egjM5hWwlXg+/x4T hC0o8WPyPRYQm1lAS2LztiZWCFteYvOat8wQx6lLPPqrC7FLT+LotYdsECUiEvtevGOcwCgw C8mkWUgmzUIyaRaSlgWMLKsYRVMLkguKk9JzjfSKE3OLS/PS9ZLzczcxgqPwmfQOxlUNFocY BTgYlXh4JYz3BQixJpYVV+YeYpTgYFYS4f1nBxTiTUmsrEotyo8vKs1JLT7E6AP06ERmKdHk fGCCyCuJNzQ2MTOyNDKzMDIxN8chrCTO2+yREiAkkJ5YkpqdmlqQWgQzjomDU6qBMTTximju weMHrvzSfK2xjG3O8k0XteqLjj/Mf/dk4h4zQ07HDJ+a4s6eW6K/TnX0ctxoa94pcZTxp6yT ysPNN7uVrQWy4j/tyjS5e2zWhJh/NVvmzvpoNPvy9O7L/SGbtyd6bROKWyw9Y9V2/uOe5SIx O8umZka2Ni2cbLdFrVqu+cQ3NsOXlUosxRmJhlrMRcWJAGeNHjHvAgAA X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121204_195912_595427_EF2B3F54 X-CRM114-Status: GOOD ( 11.01 ) 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.25 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 0.0 T_MANY_HDRS_LCASE Odd capitalization of multiple message headers Cc: 'Florian Tobias Schandinat' , 'Marko Katic' , 'Jingoo Han' , 'Grant Likely' , 'Richard Purdie' , 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: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Marko Katic Changing backlight intensity on an Akita (Sharp Zaurus C-1000) triggers WARN_ON message: WARNING: at drivers/gpio/gpiolib.c:1672 __gpio_set_value+0x38/0xa4() Modules linked in: Backtrace: [] (dump_backtrace+0x0/0x110) from [] (dump_stack+0x18/0x1c) r6:c0158fc8 r5:00000009 r4:00000000 r3:c03d4f70 [] (dump_stack+0x0/0x1c) from [] (warn_slowpath_common+0x54/0x6c) [] (warn_slowpath_common+0x0/0x6c) from [] (warn_slowpath_null+0x24/0x2c) r8:c38d5c00 r7:c03f82c0 r6:00000000 r5:000000d0 r4:c384e4fc r3:00000009 [] (warn_slowpath_null+0x0/0x2c) from [] (__gpio_set_value+0x38/0xa4) [] (__gpio_set_value+0x0/0xa4) from [] (corgi_bl_set_intensity+0x44/0x74) r7:c3933418 r6:c3933400 r5:c392cdf0 r4:0000002f [] (corgi_bl_set_intensity+0x0/0x74) from [] (corgi_bl_update_status+0x5c/0x64) r5:c03d31f0 r4:c3933400 [] (corgi_bl_update_status+0x0/0x64) from [] (corgi_lcd_probe+0x1a8/0x258) r4:c392cdf0 r3:c0169bc0 [] (corgi_lcd_probe+0x0/0x258) from [] (spi_drv_probe+0x20/0x24) r8:00000052 r7:c0192d9c r6:c03da6e8 r5:c38d5c34 r4:c38d5c00 [] (spi_drv_probe+0x0/0x24) from [] (driver_probe_device+0xb0/0x208) [] (driver_probe_device+0x0/0x208) from [] (__driver_attach+0x70/0x94) r6:c03da6e8 r5:c38d5c34 r4:c38d5c00 r3:00000000 [] (__driver_attach+0x0/0x94) from [] (bus_for_each_dev+0x54/0x90) r6:c03da6e8 r5:c3827e80 r4:00000000 r3:00000000 [] (bus_for_each_dev+0x0/0x90) from [] (driver_attach+0x20/0x28) r7:00000000 r6:c03e29ec r5:c3932980 r4:c03da6e8 [] (driver_attach+0x0/0x28) from [] (bus_add_driver+0xd4/0x22c) [] (bus_add_driver+0x0/0x22c) from [] (driver_register+0xa4/0x134) r8:00000052 r7:c03ea900 r6:c03c32ac r5:c03bdfc8 r4:c03da6e8 [] (driver_register+0x0/0x134) from [] (spi_register_driver+0x4c/0x60) [] (spi_register_driver+0x0/0x60) from [] (corgi_lcd_driver_init+0x14/0x1c) [] (corgi_lcd_driver_init+0x0/0x1c) from [] (do_one_initcall+0x9c/0x174) [] (do_one_initcall+0x0/0x174) from [] (kernel_init+0xf4/0x2a8) [] (kernel_init+0x0/0x2a8) from [] (ret_from_fork+0x14/0x24) ---[ end trace a863a63f242ee38c ]--- Akita machines have backlight controls hooked to a gpio expander chip, max7310 using i2c transfers which can sleep. In this case, pca953x_gpio_set_value() can be called to control gpio, and pca953x_setup_gpio() sets can_sleep flag. Therefore, gpio_set_value_cansleep() should be used in order to avoid WARN_ON on akita machines. Akita is the only exception in this case since other users of corgi_lcd access backlight gpio controls through a different gpio expander which does not set the can_sleep flag. [jg1.han@samsung.com: used gpio_cansleep()] Signed-off-by: Marko Katic Signed-off-by: Jingoo Han --- Change since v3: - remove redundant wording from commit message Change since v2: - use gpio_cansleep() drivers/video/backlight/corgi_lcd.c | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c index e2e1b62..e5168f4 100644 --- a/drivers/video/backlight/corgi_lcd.c +++ b/drivers/video/backlight/corgi_lcd.c @@ -408,11 +408,20 @@ static int corgi_bl_set_intensity(struct corgi_lcd *lcd, int intensity) /* Bit 5 via GPIO_BACKLIGHT_CONT */ cont = !!(intensity & 0x20) ^ lcd->gpio_backlight_cont_inverted; - if (gpio_is_valid(lcd->gpio_backlight_cont)) - gpio_set_value(lcd->gpio_backlight_cont, cont); + if (gpio_is_valid(lcd->gpio_backlight_cont)) { + if (gpio_cansleep(lcd->gpio_backlight_cont)) + gpio_set_value_cansleep(lcd->gpio_backlight_cont, cont); + else + gpio_set_value(lcd->gpio_backlight_cont, cont); + } - if (gpio_is_valid(lcd->gpio_backlight_on)) - gpio_set_value(lcd->gpio_backlight_on, intensity); + if (gpio_is_valid(lcd->gpio_backlight_on)) { + if (gpio_cansleep(lcd->gpio_backlight_on)) + gpio_set_value_cansleep(lcd->gpio_backlight_on, + intensity); + else + gpio_set_value(lcd->gpio_backlight_on, intensity); + } if (lcd->kick_battery) lcd->kick_battery();