From patchwork Wed Sep 10 19:40:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ping Cheng X-Patchwork-Id: 4880331 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 026DCC0338 for ; Wed, 10 Sep 2014 19:40:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E0E522010E for ; Wed, 10 Sep 2014 19:40:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C127D201D5 for ; Wed, 10 Sep 2014 19:40:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751754AbaIJTkP (ORCPT ); Wed, 10 Sep 2014 15:40:15 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:47152 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751044AbaIJTkO (ORCPT ); Wed, 10 Sep 2014 15:40:14 -0400 Received: by mail-pa0-f52.google.com with SMTP id kq14so5222660pab.25 for ; Wed, 10 Sep 2014 12:40:14 -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=hw35R559S5QMZvmmKicUKr4oZZ0Lww5QIii/1+qihrI=; b=Fy+OWMmhDcKU74OwHJNsEguJEonydYMPY8Zfhi96TbBQ2mACnacR4VozFbv+ZE4XUr lX2R9/XQ9KjqSHFm8t7+RsByPQ9gcOgHvAgqJTTalDxIDYGKlf+EDjq5jo+cGAxFY/k/ Qom1TyesCDiExSfDBBp1knRDxCiDCNpjUVkkOQ26IwRvQdttK2mRqNitWxndJV4ubb5G MxrOgKLmQtJypfMnOpBT47MNkJH0V/NXNFCB+EablHn/yDXFXIuQKNzYizQeXB66CuDG 1wLoc4XE2QbnH4FqVpZclA/5+GZcus267HOWIV11dhAv/QCumT7feRnUu3KmqATcBu8x xtFg== X-Received: by 10.70.96.200 with SMTP id du8mr51400076pdb.117.1410378014065; Wed, 10 Sep 2014 12:40:14 -0700 (PDT) Received: from wacom-XPS-8500.wacom.com ([67.51.163.2]) by mx.google.com with ESMTPSA id d3sm7962989pbu.18.2014.09.10.12.40.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 Sep 2014 12:40:12 -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 1/4 v2] HID: wacom - Add default permission defines for sysfs attributes Date: Wed, 10 Sep 2014 12:40:05 -0700 Message-Id: <1410378005-14464-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 RW : ug=rw,o=r WO : ug=w And enabled reading relavent sysfs attributes. Signed-off-by: Paul A. Tessier Signed-Off-by: Ping Cheng Tested-by: Benjamin Tissoires --- v2: Integrate actual permission with defines. drivers/hid/wacom_sys.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index f0db7ec..950a205 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -23,6 +23,9 @@ #define WAC_CMD_ICON_BT_XFER 0x26 #define WAC_CMD_RETRIES 10 +#define DEV_ATTR_RW_PERM (S_IRUGO | S_IWUSR | S_IWGRP) +#define DEV_ATTR_WO_PERM (S_IWUSR | S_IWGRP) + static int wacom_get_report(struct hid_device *hdev, u8 type, u8 id, void *buf, size_t size, unsigned int retries) { @@ -604,7 +607,7 @@ static ssize_t wacom_led##SET_ID##_select_show(struct device *dev, \ struct wacom *wacom = hid_get_drvdata(hdev); \ return snprintf(buf, 2, "%d\n", wacom->led.select[SET_ID]); \ } \ -static DEVICE_ATTR(status_led##SET_ID##_select, S_IWUSR | S_IRUSR, \ +static DEVICE_ATTR(status_led##SET_ID##_select, DEV_ATTR_RW_PERM, \ wacom_led##SET_ID##_select_show, \ wacom_led##SET_ID##_select_store) @@ -641,7 +644,7 @@ static ssize_t wacom_##name##_luminance_store(struct device *dev, \ return wacom_luminance_store(wacom, &wacom->led.field, \ buf, count); \ } \ -static DEVICE_ATTR(name##_luminance, S_IWUSR, \ +static DEVICE_ATTR(name##_luminance, DEV_ATTR_RW_PERM, \ NULL, wacom_##name##_luminance_store) DEVICE_LUMINANCE_ATTR(status0, llv); @@ -683,7 +686,7 @@ static ssize_t wacom_btnimg##BUTTON_ID##_store(struct device *dev, \ { \ return wacom_button_image_store(dev, BUTTON_ID, buf, count); \ } \ -static DEVICE_ATTR(button##BUTTON_ID##_rawimg, S_IWUSR, \ +static DEVICE_ATTR(button##BUTTON_ID##_rawimg, DEV_ATTR_WO_PERM, \ NULL, wacom_btnimg##BUTTON_ID##_store) DEVICE_BTNIMG_ATTR(0); @@ -989,7 +992,7 @@ static ssize_t wacom_store_speed(struct device *dev, return count; } -static DEVICE_ATTR(speed, S_IRUGO | S_IWUSR | S_IWGRP, +static DEVICE_ATTR(speed, DEV_ATTR_RW_PERM, wacom_show_speed, wacom_store_speed); static struct input_dev *wacom_allocate_input(struct wacom *wacom)