From patchwork Thu Jan 6 21:04:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 460651 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p06L6IjI028389 for ; Thu, 6 Jan 2011 21:06:19 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753396Ab1AFVFv (ORCPT ); Thu, 6 Jan 2011 16:05:51 -0500 Received: from smtp1.linux-foundation.org ([140.211.169.13]:58234 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753030Ab1AFVFu (ORCPT ); Thu, 6 Jan 2011 16:05:50 -0500 Received: from imap1.linux-foundation.org (imap1.linux-foundation.org [140.211.169.55]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p06L4fK0023696 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 6 Jan 2011 13:04:41 -0800 Received: from akpm.mtv.corp.google.com (localhost [127.0.0.1]) by imap1.linux-foundation.org (8.13.5.20060308/8.13.5/Debian-3ubuntu1.1) with SMTP id p06L4e8J015383; Thu, 6 Jan 2011 13:04:41 -0800 Date: Thu, 6 Jan 2011 13:04:40 -0800 From: Andrew Morton To: Janusz Krzysztofik Cc: Richard Purdie , "linux-fbdev@vger.kernel.org" , linux-kernel@vger.kernel.org, "linux-omap@vger.kernel.org" , Paul Mundt Subject: Re: [RESEND #2] [PATCH v2] LEDS: Add output invertion option to backlight trigger Message-Id: <20110106130440.cfd77c8e.akpm@linux-foundation.org> In-Reply-To: <201012091441.51846.jkrzyszt@tis.icnet.pl> References: <201012091441.51846.jkrzyszt@tis.icnet.pl> X-Mailer: Sylpheed 3.0.2 (GTK+ 2.20.1; x86_64-pc-linux-gnu) Mime-Version: 1.0 X-Spam-Status: No, hits=-3.488 required=5 tests=AWL, BAYES_00, OSDL_HEADER_SUBJECT_BRACKETED X-Spam-Checker-Version: SpamAssassin 3.2.4-osdl_revision__1.47__ X-MIMEDefang-Filter: lf$Revision: 1.188 $ X-Scanned-By: MIMEDefang 2.63 on 140.211.169.13 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 06 Jan 2011 21:06:19 +0000 (UTC) --- a/drivers/leds/ledtrig-backlight.c~leds-add-output-inversion-option-to-backlight-trigger-fix +++ a/drivers/leds/ledtrig-backlight.c @@ -65,7 +65,7 @@ static ssize_t bl_trig_invert_show(struc struct led_classdev *led = dev_get_drvdata(dev); struct bl_trig_notifier *n = led->trigger_data; - return sprintf(buf, "%s\n", n->invert ? "yes" : "no"); + return sprintf(buf, "%u\n", n->invert); } static ssize_t bl_trig_invert_store(struct device *dev, @@ -73,16 +73,17 @@ static ssize_t bl_trig_invert_store(stru { struct led_classdev *led = dev_get_drvdata(dev); struct bl_trig_notifier *n = led->trigger_data; - unsigned invert; + unsigned long invert; int ret; - ret = sscanf(buf, "%u", &invert); - if (ret < 1) { - dev_err(dev, "invalid value\n"); + ret = strict_strtoul(buf, 10, &invert); + if (ret < 0) + return ret; + + if (invert > 1) return -EINVAL; - } - n->invert = !!invert; + n->invert = invert; /* After inverting, we need to update the LED. */ if ((n->old_status == BLANK) ^ n->invert)