From patchwork Fri Sep 10 17:14:14 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Henrik Rydberg X-Patchwork-Id: 64439 X-Patchwork-Delegate: leann.ogasawara@canonical.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id B4F04B70FF for ; Sat, 11 Sep 2010 03:16:49 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1Ou7DP-0004Kr-Vg; Fri, 10 Sep 2010 18:16:44 +0100 Received: from ch-smtp01.sth.basefarm.net ([80.76.149.212]) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1Ou7DN-0004Ke-RX for kernel-team@lists.ubuntu.com; Fri, 10 Sep 2010 18:16:41 +0100 Received: from c83-248-196-134.bredband.comhem.se ([83.248.196.134]:54295 helo=alnilam) by ch-smtp01.sth.basefarm.net with smtp (Exim 4.71) (envelope-from ) id 1Ou7Bf-00027A-58 for kernel-team@lists.ubuntu.com; Fri, 10 Sep 2010 19:14:59 +0200 Received: by alnilam (sSMTP sendmail emulation); Fri, 10 Sep 2010 19:14:55 +0200 From: "Henrik Rydberg" To: kernel-team@lists.ubuntu.com Subject: [PATCH 08/13] hid: ntrig: remove sysfs nodes Date: Fri, 10 Sep 2010 19:14:14 +0200 Message-Id: <1284138859-32673-9-git-send-email-rydberg@euromail.se> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1284138859-32673-1-git-send-email-rydberg@euromail.se> References: <1284138859-32673-1-git-send-email-rydberg@euromail.se> X-Originating-IP: 83.248.196.134 X-Scan-Result: No virus found in message 1Ou7Bf-00027A-58. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1Ou7Bf-00027A-58 b4eb2dbc80aaf79a6a76069bee4163ea X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com Aiming at a driver that requires no tuning, remove the sysfs nodes for the filter parameters. Signed-off-by: Henrik Rydberg --- drivers/hid/hid-ntrig.c | 302 ----------------------------------------------- 1 files changed, 0 insertions(+), 302 deletions(-) diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c index fa10883..a2bd101 100644 --- a/drivers/hid/hid-ntrig.c +++ b/drivers/hid/hid-ntrig.c @@ -25,32 +25,14 @@ #define NTRIG_DUPLICATE_USAGES 0x001 static unsigned int min_width; -module_param(min_width, uint, 0644); -MODULE_PARM_DESC(min_width, "Minimum touch contact width to accept."); - static unsigned int min_height; -module_param(min_height, uint, 0644); -MODULE_PARM_DESC(min_height, "Minimum touch contact height to accept."); static unsigned int activate_slack = 1; -module_param(activate_slack, uint, 0644); -MODULE_PARM_DESC(activate_slack, "Number of touch frames to ignore at " - "the start of touch input."); static unsigned int deactivate_slack = 4; -module_param(deactivate_slack, uint, 0644); -MODULE_PARM_DESC(deactivate_slack, "Number of empty frames to ignore before " - "deactivating touch."); static unsigned int activation_width = 64; -module_param(activation_width, uint, 0644); -MODULE_PARM_DESC(activation_width, "Width threshold to immediately start " - "processing touch events."); - static unsigned int activation_height = 32; -module_param(activation_height, uint, 0644); -MODULE_PARM_DESC(activation_height, "Height threshold to immediately start " - "processing touch events."); struct ntrig_data { /* Incoming raw values for a single contact */ @@ -90,286 +72,6 @@ struct ntrig_data { }; -static ssize_t show_phys_width(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct hid_device *hdev = container_of(dev, struct hid_device, dev); - struct ntrig_data *nd = hid_get_drvdata(hdev); - - return sprintf(buf, "%d\n", nd->sensor_physical_width); -} - -static DEVICE_ATTR(sensor_physical_width, S_IRUGO, show_phys_width, NULL); - -static ssize_t show_phys_height(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct hid_device *hdev = container_of(dev, struct hid_device, dev); - struct ntrig_data *nd = hid_get_drvdata(hdev); - - return sprintf(buf, "%d\n", nd->sensor_physical_height); -} - -static DEVICE_ATTR(sensor_physical_height, S_IRUGO, show_phys_height, NULL); - -static ssize_t show_log_width(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct hid_device *hdev = container_of(dev, struct hid_device, dev); - struct ntrig_data *nd = hid_get_drvdata(hdev); - - return sprintf(buf, "%d\n", nd->sensor_logical_width); -} - -static DEVICE_ATTR(sensor_logical_width, S_IRUGO, show_log_width, NULL); - -static ssize_t show_log_height(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct hid_device *hdev = container_of(dev, struct hid_device, dev); - struct ntrig_data *nd = hid_get_drvdata(hdev); - - return sprintf(buf, "%d\n", nd->sensor_logical_height); -} - -static DEVICE_ATTR(sensor_logical_height, S_IRUGO, show_log_height, NULL); - -static ssize_t show_min_width(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct hid_device *hdev = container_of(dev, struct hid_device, dev); - struct ntrig_data *nd = hid_get_drvdata(hdev); - - return sprintf(buf, "%d\n", nd->min_width * - nd->sensor_physical_width / - nd->sensor_logical_width); -} - -static ssize_t set_min_width(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct hid_device *hdev = container_of(dev, struct hid_device, dev); - struct ntrig_data *nd = hid_get_drvdata(hdev); - - unsigned long val; - - if (strict_strtoul(buf, 0, &val)) - return -EINVAL; - - if (val > nd->sensor_physical_width) - return -EINVAL; - - nd->min_width = val * nd->sensor_logical_width / - nd->sensor_physical_width; - - return count; -} - -static DEVICE_ATTR(min_width, S_IWUSR | S_IRUGO, show_min_width, set_min_width); - -static ssize_t show_min_height(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct hid_device *hdev = container_of(dev, struct hid_device, dev); - struct ntrig_data *nd = hid_get_drvdata(hdev); - - return sprintf(buf, "%d\n", nd->min_height * - nd->sensor_physical_height / - nd->sensor_logical_height); -} - -static ssize_t set_min_height(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct hid_device *hdev = container_of(dev, struct hid_device, dev); - struct ntrig_data *nd = hid_get_drvdata(hdev); - - unsigned long val; - - if (strict_strtoul(buf, 0, &val)) - return -EINVAL; - - if (val > nd->sensor_physical_height) - return -EINVAL; - - nd->min_height = val * nd->sensor_logical_height / - nd->sensor_physical_height; - - return count; -} - -static DEVICE_ATTR(min_height, S_IWUSR | S_IRUGO, show_min_height, - set_min_height); - -static ssize_t show_activate_slack(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct hid_device *hdev = container_of(dev, struct hid_device, dev); - struct ntrig_data *nd = hid_get_drvdata(hdev); - - return sprintf(buf, "%d\n", nd->activate_slack); -} - -static ssize_t set_activate_slack(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct hid_device *hdev = container_of(dev, struct hid_device, dev); - struct ntrig_data *nd = hid_get_drvdata(hdev); - - unsigned long val; - - if (strict_strtoul(buf, 0, &val)) - return -EINVAL; - - if (val > 0x7f) - return -EINVAL; - - nd->activate_slack = val; - - return count; -} - -static DEVICE_ATTR(activate_slack, S_IWUSR | S_IRUGO, show_activate_slack, - set_activate_slack); - -static ssize_t show_activation_width(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct hid_device *hdev = container_of(dev, struct hid_device, dev); - struct ntrig_data *nd = hid_get_drvdata(hdev); - - return sprintf(buf, "%d\n", nd->activation_width * - nd->sensor_physical_width / - nd->sensor_logical_width); -} - -static ssize_t set_activation_width(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct hid_device *hdev = container_of(dev, struct hid_device, dev); - struct ntrig_data *nd = hid_get_drvdata(hdev); - - unsigned long val; - - if (strict_strtoul(buf, 0, &val)) - return -EINVAL; - - if (val > nd->sensor_physical_width) - return -EINVAL; - - nd->activation_width = val * nd->sensor_logical_width / - nd->sensor_physical_width; - - return count; -} - -static DEVICE_ATTR(activation_width, S_IWUSR | S_IRUGO, show_activation_width, - set_activation_width); - -static ssize_t show_activation_height(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct hid_device *hdev = container_of(dev, struct hid_device, dev); - struct ntrig_data *nd = hid_get_drvdata(hdev); - - return sprintf(buf, "%d\n", nd->activation_height * - nd->sensor_physical_height / - nd->sensor_logical_height); -} - -static ssize_t set_activation_height(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct hid_device *hdev = container_of(dev, struct hid_device, dev); - struct ntrig_data *nd = hid_get_drvdata(hdev); - - unsigned long val; - - if (strict_strtoul(buf, 0, &val)) - return -EINVAL; - - if (val > nd->sensor_physical_height) - return -EINVAL; - - nd->activation_height = val * nd->sensor_logical_height / - nd->sensor_physical_height; - - return count; -} - -static DEVICE_ATTR(activation_height, S_IWUSR | S_IRUGO, - show_activation_height, set_activation_height); - -static ssize_t show_deactivate_slack(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct hid_device *hdev = container_of(dev, struct hid_device, dev); - struct ntrig_data *nd = hid_get_drvdata(hdev); - - return sprintf(buf, "%d\n", -nd->deactivate_slack); -} - -static ssize_t set_deactivate_slack(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct hid_device *hdev = container_of(dev, struct hid_device, dev); - struct ntrig_data *nd = hid_get_drvdata(hdev); - - unsigned long val; - - if (strict_strtoul(buf, 0, &val)) - return -EINVAL; - - /* - * No more than 8 terminal frames have been observed so far - * and higher slack is highly likely to leave the single - * touch emulation stuck down. - */ - if (val > 7) - return -EINVAL; - - nd->deactivate_slack = -val; - - return count; -} - -static DEVICE_ATTR(deactivate_slack, S_IWUSR | S_IRUGO, show_deactivate_slack, - set_deactivate_slack); - -static struct attribute *sysfs_attrs[] = { - &dev_attr_sensor_physical_width.attr, - &dev_attr_sensor_physical_height.attr, - &dev_attr_sensor_logical_width.attr, - &dev_attr_sensor_logical_height.attr, - &dev_attr_min_height.attr, - &dev_attr_min_width.attr, - &dev_attr_activate_slack.attr, - &dev_attr_activation_width.attr, - &dev_attr_activation_height.attr, - &dev_attr_deactivate_slack.attr, - NULL -}; - -static struct attribute_group ntrig_attribute_group = { - .attrs = sysfs_attrs -}; - /* * this driver is aimed at two firmware versions in circulation: * - dual pen/finger single touch @@ -848,8 +550,6 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id) if (report) usbhid_submit_report(hdev, report, USB_DIR_OUT); - ret = sysfs_create_group(&hdev->dev.kobj, - &ntrig_attribute_group); return 0; err_free: @@ -859,8 +559,6 @@ err_free: static void ntrig_remove(struct hid_device *hdev) { - sysfs_remove_group(&hdev->dev.kobj, - &ntrig_attribute_group); hid_hw_stop(hdev); kfree(hid_get_drvdata(hdev)); }