From patchwork Wed Sep 10 19:40:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ping Cheng X-Patchwork-Id: 4880341 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@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 67B1EC0338 for ; Wed, 10 Sep 2014 19:40:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6490720145 for ; Wed, 10 Sep 2014 19:40:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 633502010E for ; Wed, 10 Sep 2014 19:40:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752649AbaIJTkl (ORCPT ); Wed, 10 Sep 2014 15:40:41 -0400 Received: from mail-pd0-f169.google.com ([209.85.192.169]:33545 "EHLO mail-pd0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751074AbaIJTkl (ORCPT ); Wed, 10 Sep 2014 15:40:41 -0400 Received: by mail-pd0-f169.google.com with SMTP id fp1so6194223pdb.28 for ; Wed, 10 Sep 2014 12:40:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=TQWn7YOVfK38Tgb99X0ZtFm8RDhyfXgruViU+etM//I=; b=F12Llw1t6keXbs+P0F462NM2pFoZqMVL7N4RKglVVWVKRtGQ02vsOWUsPtJcLpihOi +8HPwLDv2r9NFkjndqn/Y+Sa3YOxWgXoRLotzbGh5b5N2dTr80volGNN5MiRfIhjxMx3 CLxvgVu3F5r7o//Yf/l4HnBsuGoOHKNuc+pZqYo8zGZB6wTPZLcSGv4XSvCfm6RLsTMG nsWkFp7BOELMG5APSACvsscrB/GdT/vL5SDVpkXl7NszncUtN/C5bY0wwU3Msif5KlEu QpTLP0cfixbbJtQcFCbKMVilzlkO0TZRiLuWxp+ohRuP7zAnWZ5bnpnNCeiXP133+JLx 2I0Q== X-Received: by 10.70.42.135 with SMTP id o7mr7410411pdl.141.1410378040714; Wed, 10 Sep 2014 12:40:40 -0700 (PDT) Received: from wacom-XPS-8500.wacom.com ([67.51.163.2]) by mx.google.com with ESMTPSA id iu10sm15229280pbd.57.2014.09.10.12.40.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 Sep 2014 12:40:39 -0700 (PDT) From: Ping Cheng X-Google-Original-From: Ping Cheng To: jkosina@suse.cz Cc: killertofu@gmail.com, linux-input@vger.kernel.org, Ping Cheng , "Paul A. Tessier" Subject: [PATCH 2/4 v2] HID: wacom - Clean up of sysfs Date: Wed, 10 Sep 2014 12:40:30 -0700 Message-Id: <1410378030-14504-1-git-send-email-pingc@wacom.com> X-Mailer: git-send-email 1.9.1 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-9.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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 changed to scnprintf(buf, PAGE_SIZE, ... ) as suggested in sysfs.txt for show functions Signed-off-by: Paul A. Tessier Signed-Off-by: Ping Cheng Tested-by: Benjamin Tissoires --- v2: Move actual permission to patch one. drivers/hid/wacom_sys.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 950a205..4a7b9c8 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -605,7 +605,8 @@ static ssize_t wacom_led##SET_ID##_select_show(struct device *dev, \ { \ struct hid_device *hdev = container_of(dev, struct hid_device, dev);\ struct wacom *wacom = hid_get_drvdata(hdev); \ - return snprintf(buf, 2, "%d\n", wacom->led.select[SET_ID]); \ + return scnprintf(buf, PAGE_SIZE, "%d\n", \ + wacom->led.select[SET_ID]); \ } \ static DEVICE_ATTR(status_led##SET_ID##_select, DEV_ATTR_RW_PERM, \ wacom_led##SET_ID##_select_show, \ @@ -644,8 +645,15 @@ static ssize_t wacom_##name##_luminance_store(struct device *dev, \ return wacom_luminance_store(wacom, &wacom->led.field, \ buf, count); \ } \ +static ssize_t wacom_##name##_luminance_show(struct device *dev, \ + struct device_attribute *attr, char *buf) \ +{ \ + struct wacom *wacom = dev_get_drvdata(dev); \ + return scnprintf(buf, PAGE_SIZE, "%d\n", wacom->led.field); \ +} \ static DEVICE_ATTR(name##_luminance, DEV_ATTR_RW_PERM, \ - NULL, wacom_##name##_luminance_store) + wacom_##name##_luminance_show, \ + wacom_##name##_luminance_store) DEVICE_LUMINANCE_ATTR(status0, llv); DEVICE_LUMINANCE_ATTR(status1, hlv);