From patchwork Mon Aug 12 15:20:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joshua Clayton X-Patchwork-Id: 11090053 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2ABBD1398 for ; Mon, 12 Aug 2019 15:20:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A7FE28306 for ; Mon, 12 Aug 2019 15:20:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0DB332837E; Mon, 12 Aug 2019 15:20:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AFDC928306 for ; Mon, 12 Aug 2019 15:20:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727385AbfHLPUi (ORCPT ); Mon, 12 Aug 2019 11:20:38 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:36734 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727122AbfHLPUi (ORCPT ); Mon, 12 Aug 2019 11:20:38 -0400 Received: by mail-ot1-f68.google.com with SMTP id k18so28021577otr.3; Mon, 12 Aug 2019 08:20:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Zbw0t6lejk4G6cnkRecei3s1P5sNxAOl1amPr4XO5a0=; b=XUbrbMiPdC4CsGZo+BrXMTeROlKzIsaOvXUR4UzkqeJKNOVMv0xqBdCWPxign2/PI3 hbWQki1CTgaL45djIDH8Q9Tz5BP0sjFR0oLooi4/v/MvUCC4pEi7BoaCqDXCwDe5CLwy UZfbr+6aujfiKa+Ey/m3J3/QVzBgMoNX8I7VW1kgkEG+rJrz1jU5ujGCizrw2wAHmk+u VEdisRV0jcGiKQAD+Z3Rp4x2boADfN818OUwb8I4m7rCyOMYmFqJrs+rdTfqgfQDZJj7 h9PJY8Hp7l231v9wzmOsU8rTcWPNZlDfXgX6PMJol+7tb6KP9VWVBKS8aC7OwwzwfRnD J3UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Zbw0t6lejk4G6cnkRecei3s1P5sNxAOl1amPr4XO5a0=; b=r1Z+ojp/fOywMeNQzARdEB/CqPoAc2T4MSBxRFcpzgVEzNAal6+XjDeB90avdGOhBg dzbB85F/h35bFkODkhc9keHOAuNST5N1RBJ3hZjKwcsT+M2FMBtnXaThd+S/hkkRB4x5 lGjJo2/IAh4ctAWlOKL9+j/WRMImSbUz8MZy7soRL0WveAHmwEYOIGJyXl5q/VR/GnuF 4F6NMZZa/Ric3/eE1auDXU4L3PbzVk22V2JyaYcbBqRocxZYjn7HpyIVYMFPgnC0gkFE sPQS6g97BR4bApRhetXUWQXLw0V3C7/iKvS94IT2Ven//PyBmzWF1jW8M2VT4GA0wBlU vf7A== X-Gm-Message-State: APjAAAU/VJ4HMxPMFmLMmYnEWotzSSV82/OglE0vctGaudH4jhrUJYmu A8QLTuLRySyLm/TLkec6/4A= X-Google-Smtp-Source: APXvYqw2Y+W44uCJ50e0/KMSB+YUxKLPGJ3sI5yWM99B1lAG2Ghf+dgUJc1gDquGQiiXsYnrEhTljg== X-Received: by 2002:aca:6044:: with SMTP id u65mr13621440oib.25.1565623237010; Mon, 12 Aug 2019 08:20:37 -0700 (PDT) Received: from localhost.localdomain ([65.154.66.198]) by smtp.gmail.com with ESMTPSA id e10sm31792662oie.37.2019.08.12.08.20.35 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 12 Aug 2019 08:20:36 -0700 (PDT) From: stillcompiling@gmail.com To: Jiri Kosina , Benjamin Tissoires , linux-input@vger.kernel.org (open list:HID CORE LAYER), linux-kernel@vger.kernel.org (open list) Cc: Joe Perches , Joshua Clayton Subject: [PATCH v3 1/3] HID: core: reformat and reduce hid_printk macros Date: Mon, 12 Aug 2019 09:20:20 -0600 Message-Id: <20190812152022.27963-2-stillcompiling@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190812152022.27963-1-stillcompiling@gmail.com> References: <20190812152022.27963-1-stillcompiling@gmail.com> MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Joshua Clayton Reformat hid_printk macros to use standard __VA_ARGS__ syntax. Per Joe Perches hid_printk(), hid_emerg(), hid_crit(), and hid_alert() are unlikely ever to be used. Remove them. Signed-off-by: Joshua Clayton diff --git a/include/linux/hid.h b/include/linux/hid.h index d770ab1a0479..e6c7efdb0458 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -1154,29 +1154,21 @@ int hid_pidff_init(struct hid_device *hid); #define hid_pidff_init NULL #endif -#define dbg_hid(format, arg...) \ +#define dbg_hid(fmt, ...) \ do { \ if (hid_debug) \ - printk(KERN_DEBUG "%s: " format, __FILE__, ##arg); \ + printk(KERN_DEBUG "%s: " fmt, __FILE__, ##__VA_ARGS__); \ } while (0) -#define hid_printk(level, hid, fmt, arg...) \ - dev_printk(level, &(hid)->dev, fmt, ##arg) -#define hid_emerg(hid, fmt, arg...) \ - dev_emerg(&(hid)->dev, fmt, ##arg) -#define hid_crit(hid, fmt, arg...) \ - dev_crit(&(hid)->dev, fmt, ##arg) -#define hid_alert(hid, fmt, arg...) \ - dev_alert(&(hid)->dev, fmt, ##arg) -#define hid_err(hid, fmt, arg...) \ - dev_err(&(hid)->dev, fmt, ##arg) -#define hid_notice(hid, fmt, arg...) \ - dev_notice(&(hid)->dev, fmt, ##arg) -#define hid_warn(hid, fmt, arg...) \ - dev_warn(&(hid)->dev, fmt, ##arg) -#define hid_info(hid, fmt, arg...) \ - dev_info(&(hid)->dev, fmt, ##arg) -#define hid_dbg(hid, fmt, arg...) \ - dev_dbg(&(hid)->dev, fmt, ##arg) +#define hid_err(hid, fmt, ...) \ + dev_err(&(hid)->dev, fmt, ##__VA_ARGS__) +#define hid_notice(hid, fmt, ...) \ + dev_notice(&(hid)->dev, fmt, ##__VA_ARGS__) +#define hid_warn(hid, fmt, ...) \ + dev_warn(&(hid)->dev, fmt, ##__VA_ARGS__) +#define hid_info(hid, fmt, ...) \ + dev_info(&(hid)->dev, fmt, ##__VA_ARGS__) +#define hid_dbg(hid, fmt, ...) \ + dev_dbg(&(hid)->dev, fmt, ##__VA_ARGS__) #endif From patchwork Mon Aug 12 15:20:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joshua Clayton X-Patchwork-Id: 11090055 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A08661398 for ; Mon, 12 Aug 2019 15:20:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8CCDE26E69 for ; Mon, 12 Aug 2019 15:20:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 80BDA28306; Mon, 12 Aug 2019 15:20:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A8CA26E69 for ; Mon, 12 Aug 2019 15:20:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727805AbfHLPUj (ORCPT ); Mon, 12 Aug 2019 11:20:39 -0400 Received: from mail-ot1-f66.google.com ([209.85.210.66]:37140 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727122AbfHLPUj (ORCPT ); Mon, 12 Aug 2019 11:20:39 -0400 Received: by mail-ot1-f66.google.com with SMTP id f17so24753959otq.4; Mon, 12 Aug 2019 08:20:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=87ODSluuxCJzsTsVGfec1oF5jXVmP/F4heF7BnrVH7o=; b=iYnb6LUacW57ui0QG9Sj7a0v4TbbKqq83L4ClVfLbDVd8dFsNjxAzhh4yEUc+XI78T 2C3+owellt61xBpNP1FW2unvG1Ug8+o/MEe54iBdBLgD3ug13+7K1r8o5aiLgIMVBDOU raEg0lQEbZI9vPaiWBq3eFB1vdpqnqoTI28PJzWuE74Xvd2DOtAcIUYYEXhRsIaL2gCo 4CyMmd5Pra6i+52TMF7eU6NL2G6yKLd9F2QEOOVS6zzFhUIkEfdEUxm2XiNDcLeFEvHP 7wz4sm6Zrpa4m+jXeH3YL5V/OOweJ0qLNJyXxR9X+ap+uy8Rf8VZZ7ThOWv/Kowz9XaP J0Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=87ODSluuxCJzsTsVGfec1oF5jXVmP/F4heF7BnrVH7o=; b=pf+NkJfJAtEQkiwrolbRBL4XcGxtQQWLCiKK9QKsjhuQJt/444kmP+StNfPLL8k9Gk urBHBSL8d6MdWPDrd3vnBtAJQdREKRS3DRtjiqvqcVuw+8YNf9jGMjDsP4HDHj3w+m7v EIaAuziBmhHabIoXyqw9+t4yPOcxaHsBfGazRZCi5YBFsivizjlhb1mzEdDVh45BGj02 muL7ubF4zA0jk9dlPyn0hT1XBQi1FFdlInf4jSKshz9/iXwqEGP5FlHV3smLbt5mVpiw WYFEgUBu06aLs8an5x8JAtdCRLWMqAX6FE/+U8C1ZRnh1YbbDW/GDVYt0pWfp4LNYhEb TTLQ== X-Gm-Message-State: APjAAAW+Fw9ag7Ol4OWHGMrBgisTH/Ce4UgMntEG5s8QD+nntEK4rnZd OPTgwRnlDhNHpzUE+TZslQw= X-Google-Smtp-Source: APXvYqxL6dW0dn+LxwAm/Yg3uUF27dLIT6hMuSG6syRQVnXZG8jG/LKnUiXQWjcVk/zmMSJedQjfXw== X-Received: by 2002:a9d:6a4d:: with SMTP id h13mr8191899otn.259.1565623238036; Mon, 12 Aug 2019 08:20:38 -0700 (PDT) Received: from localhost.localdomain ([65.154.66.198]) by smtp.gmail.com with ESMTPSA id e10sm31792662oie.37.2019.08.12.08.20.37 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 12 Aug 2019 08:20:37 -0700 (PDT) From: stillcompiling@gmail.com To: Jiri Kosina , Benjamin Tissoires , linux-input@vger.kernel.org (open list:HID CORE LAYER), linux-kernel@vger.kernel.org (open list) Cc: Joe Perches , Joshua Clayton Subject: [PATCH v3 2/3] HID: core: Add printk_once variants to hid_warn() etc Date: Mon, 12 Aug 2019 09:20:21 -0600 Message-Id: <20190812152022.27963-3-stillcompiling@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190812152022.27963-1-stillcompiling@gmail.com> References: <20190812152022.27963-1-stillcompiling@gmail.com> MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Joshua Clayton hid_warn_once() is needed. Add the others as part of the block. Signed-off-by: Joshua Clayton diff --git a/include/linux/hid.h b/include/linux/hid.h index e6c7efdb0458..cd41f209043f 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -1171,4 +1171,15 @@ do { \ #define hid_dbg(hid, fmt, ...) \ dev_dbg(&(hid)->dev, fmt, ##__VA_ARGS__) +#define hid_err_once(hid, fmt, ...) \ + dev_err_once(&(hid)->dev, fmt, ##__VA_ARGS__) +#define hid_notice_once(hid, fmt, ...) \ + dev_notice_once(&(hid)->dev, fmt, ##__VA_ARGS__) +#define hid_warn_once(hid, fmt, ...) \ + dev_warn_once(&(hid)->dev, fmt, ##__VA_ARGS__) +#define hid_info_once(hid, fmt, ...) \ + dev_info_once(&(hid)->dev, fmt, ##__VA_ARGS__) +#define hid_dbg_once(hid, fmt, ...) \ + dev_dbg_once(&(hid)->dev, fmt, ##__VA_ARGS__) + #endif From patchwork Mon Aug 12 15:20:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joshua Clayton X-Patchwork-Id: 11090057 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B2652746 for ; Mon, 12 Aug 2019 15:20:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A2DFB1FF73 for ; Mon, 12 Aug 2019 15:20:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9713A283A5; Mon, 12 Aug 2019 15:20:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45ADA2837D for ; Mon, 12 Aug 2019 15:20:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727122AbfHLPUn (ORCPT ); Mon, 12 Aug 2019 11:20:43 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:40554 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727159AbfHLPUj (ORCPT ); Mon, 12 Aug 2019 11:20:39 -0400 Received: by mail-ot1-f68.google.com with SMTP id c34so20129684otb.7; Mon, 12 Aug 2019 08:20:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UMUwcjCxzqE/dmDLP1n/O3yo7MPYfXrBlS1+I6zzLWw=; b=PCGID3YGhe0d/4V+x61YoEJYzbSjJwEePHz4OktgEZ8vhUK8Rl3A33TbejSTHTtMhe xCgOnrBdkxB7lGH0UrRIyMwT6Q1Eed2lXvGS3wHNLrFQnZALxtHHHcpVZSTeUVQTil6H NshwoPebomZur99lH2uu8Q3yV1BNZzRFzF3lj6x03IAn54d4GMcwHZ1I7zsxMwBOK4Or r/83TrUz57EDH55AnrcJDlzUQSbEnKq77l5v2gVShb8Dw/+oFcXQi4Z2gIFW0DHLPvur S+mdaM6e0JDafW0TXqulK7HKRf2y4zrUVbwUaKNBCtsPfM103ajCLLA2C4juQ8lCRCp5 yuSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UMUwcjCxzqE/dmDLP1n/O3yo7MPYfXrBlS1+I6zzLWw=; b=WNdFzfnn3nWTo9977ZDYTrWdesb9P5uGODCIbIxOuYfCyErljurPL00ZAMiJ2cV7ZG jXfppsgg9c2/j7ypa5CaF7jwf+cxEx8TJweozoFYbUJybq9u60xTIcHLv/BlQWuUJVt/ HzgE2oPvA76iro3sXkR2Lmhoek5ij/CqIOTJsyGxVVNJuh4hb5fAE0+xWXXu3cG1Tqyt l7OSsjw6fZLe/RDqVvL04iyLyAk4k/BIqmWD3Od8Jq7ArGYLM6HoxdR+CAK/cQLAkMIa 8PDDd9rfqYW4gQpgrjvEx0NZmIb84RBt/3lAmwxJtAtHT9TC+3SutK0QW2xEm8B0NdFM oJog== X-Gm-Message-State: APjAAAWRsckHYa1zT7QKp/KF7Ee5t4lCld2tECrds+ugvhBjxiUq+pwm FgyWU8VW36jrYL8XKx9FhH4= X-Google-Smtp-Source: APXvYqx1lLeXCgzc2FpM636zM2+o9xesZLHfAnev2Fugl/jUqoSv+Td3l5PwjbvgIZXRJoZI+5AaEw== X-Received: by 2002:a9d:200c:: with SMTP id n12mr175723ota.334.1565623239026; Mon, 12 Aug 2019 08:20:39 -0700 (PDT) Received: from localhost.localdomain ([65.154.66.198]) by smtp.gmail.com with ESMTPSA id e10sm31792662oie.37.2019.08.12.08.20.38 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 12 Aug 2019 08:20:38 -0700 (PDT) From: stillcompiling@gmail.com To: Jiri Kosina , Benjamin Tissoires , linux-input@vger.kernel.org (open list:HID CORE LAYER), linux-kernel@vger.kernel.org (open list) Cc: Joe Perches , Joshua Clayton Subject: [PATCH v3 3/3] HID: core: fix dmesg flooding if report field larger than 32bit Date: Mon, 12 Aug 2019 09:20:22 -0600 Message-Id: <20190812152022.27963-4-stillcompiling@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190812152022.27963-1-stillcompiling@gmail.com> References: <20190812152022.27963-1-stillcompiling@gmail.com> MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Joshua Clayton Only warn once of oversize hid report value field On HP spectre x360 convertible the message: hid-sensor-hub 001F:8087:0AC2.0002: hid_field_extract() called with n (192) > 32! (kworker/1:2) is continually printed many times per second, crowding out all else. Protect dmesg by printing the warning only one time. The size of the hid report field data structure should probably be increased. The data structure is treated as a u32 in Linux, but an unlimited number of bits in the USB hid spec, so there is some rearchitecture needed now that devices are sending more than 32 bits. Signed-off-by: Joshua Clayton diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 210b81a56e1a..3eaee2c37931 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1311,8 +1311,8 @@ u32 hid_field_extract(const struct hid_device *hid, u8 *report, unsigned offset, unsigned n) { if (n > 32) { - hid_warn(hid, "hid_field_extract() called with n (%d) > 32! (%s)\n", - n, current->comm); + hid_warn_once(hid, "%s() called with n (%d) > 32! (%s)\n", + __func__, n, current->comm); n = 32; }