From patchwork Fri Oct 25 09:41:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 11212009 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 853151515 for ; Fri, 25 Oct 2019 11:09:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6D2A32084C for ; Fri, 25 Oct 2019 11:09:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502573AbfJYLJ3 (ORCPT ); Fri, 25 Oct 2019 07:09:29 -0400 Received: from andre.telenet-ops.be ([195.130.132.53]:34326 "EHLO andre.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502918AbfJYLIp (ORCPT ); Fri, 25 Oct 2019 07:08:45 -0400 Received: from ramsan ([84.195.182.253]) by andre.telenet-ops.be with bizsmtp id Hn8b2100L5USYZQ01n8bdM; Fri, 25 Oct 2019 13:08:43 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1iNxSN-0003rD-GA; Fri, 25 Oct 2019 13:08:35 +0200 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1iNw6A-0006ms-Jl; Fri, 25 Oct 2019 11:41:34 +0200 From: Geert Uytterhoeven To: Jonathan Corbet , Greg Kroah-Hartman , Ludovic Desroches , Ulf Hansson , Nicolas Ferre , Alexandre Belloni , Jaehoon Chung , "David S . Miller" , "Rafael J . Wysocki" , Johannes Berg Cc: linux-doc@vger.kernel.org, linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2 1/7] debugfs: Add debugfs_create_xul() for hexadecimal unsigned long Date: Fri, 25 Oct 2019 11:41:24 +0200 Message-Id: <20191025094130.26033-2-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191025094130.26033-1-geert+renesas@glider.be> References: <20191025094130.26033-1-geert+renesas@glider.be> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org The existing debugfs_create_ulong() function supports objects of type "unsigned long", which are 32-bit or 64-bit depending on the platform, in decimal form. To format objects in hexadecimal, various debugfs_create_x*() functions exist, but all of them take fixed-size types. Add a debugfs helper for "unsigned long" objects in hexadecimal format. This avoids the need for users to open-code the same, or introduce bugs when casting the value pointer to "u32 *" or "u64 *" to call debugfs_create_x{32,64}(). Signed-off-by: Geert Uytterhoeven --- v2: - Add kerneldoc, - Update Documentation/filesystems/debugfs.txt. --- Documentation/filesystems/debugfs.txt | 5 ++++- include/linux/debugfs.h | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Documentation/filesystems/debugfs.txt b/Documentation/filesystems/debugfs.txt index 50e8f91f2421ec04..8c8e60fe8c7deb86 100644 --- a/Documentation/filesystems/debugfs.txt +++ b/Documentation/filesystems/debugfs.txt @@ -102,11 +102,14 @@ functions meant to help out in such special cases: As might be expected, this function will create a debugfs file to represent a variable of type size_t. -Similarly, there is a helper for variables of type unsigned long: +Similarly, there are helpers for variables of type unsigned long, in decimal +and hexadecimal: struct dentry *debugfs_create_ulong(const char *name, umode_t mode, struct dentry *parent, unsigned long *value); + void debugfs_create_xul(const char *name, umode_t mode, + struct dentry *parent, unsigned long *value); Boolean values can be placed in debugfs with: diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h index 33690949b45d6904..af6c2e5b7d3c7afa 100644 --- a/include/linux/debugfs.h +++ b/include/linux/debugfs.h @@ -356,4 +356,25 @@ static inline ssize_t debugfs_write_file_bool(struct file *file, #endif +/** + * debugfs_create_xul - create a debugfs file that is used to read and write an + * unsigned long value, formatted in hexadecimal + * @name: a pointer to a string containing the name of the file to create. + * @mode: the permission that the file should have + * @parent: a pointer to the parent dentry for this file. This should be a + * directory dentry if set. If this parameter is %NULL, then the + * file will be created in the root of the debugfs filesystem. + * @value: a pointer to the variable that the file should read to and write + * from. + */ +static inline void debugfs_create_xul(const char *name, umode_t mode, + struct dentry *parent, + unsigned long *value) +{ + if (sizeof(*value) == sizeof(u32)) + debugfs_create_x32(name, mode, parent, (u32 *)value); + else + debugfs_create_x64(name, mode, parent, (u64 *)value); +} + #endif From patchwork Fri Oct 25 09:41:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 11211991 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 34C2C1390 for ; Fri, 25 Oct 2019 11:09:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 112D0222C2 for ; Fri, 25 Oct 2019 11:09:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503271AbfJYLJG (ORCPT ); Fri, 25 Oct 2019 07:09:06 -0400 Received: from baptiste.telenet-ops.be ([195.130.132.51]:55456 "EHLO baptiste.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503213AbfJYLIs (ORCPT ); Fri, 25 Oct 2019 07:08:48 -0400 Received: from ramsan ([84.195.182.253]) by baptiste.telenet-ops.be with bizsmtp id Hn8b2100H5USYZQ01n8b1k; Fri, 25 Oct 2019 13:08:46 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1iNxSN-0003rD-Co; Fri, 25 Oct 2019 13:08:35 +0200 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1iNw6A-0006mu-Kc; Fri, 25 Oct 2019 11:41:34 +0200 From: Geert Uytterhoeven To: Jonathan Corbet , Greg Kroah-Hartman , Ludovic Desroches , Ulf Hansson , Nicolas Ferre , Alexandre Belloni , Jaehoon Chung , "David S . Miller" , "Rafael J . Wysocki" , Johannes Berg Cc: linux-doc@vger.kernel.org, linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2 2/7] mac80211: Use debugfs_create_xul() helper Date: Fri, 25 Oct 2019 11:41:25 +0200 Message-Id: <20191025094130.26033-3-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191025094130.26033-1-geert+renesas@glider.be> References: <20191025094130.26033-1-geert+renesas@glider.be> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Use the new debugfs_create_xul() helper instead of open-coding the same operation. Signed-off-by: Geert Uytterhoeven Acked-by: Johannes Berg --- v2: - No changes. --- net/mac80211/debugfs_sta.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c index c8ad20c28c438dab..ca34dcdac8c0bd4d 100644 --- a/net/mac80211/debugfs_sta.c +++ b/net/mac80211/debugfs_sta.c @@ -928,12 +928,7 @@ STA_OPS(he_capa); sta->debugfs_dir, sta, &sta_ ##name## _ops); #define DEBUGFS_ADD_COUNTER(name, field) \ - if (sizeof(sta->field) == sizeof(u32)) \ - debugfs_create_u32(#name, 0400, sta->debugfs_dir, \ - (u32 *) &sta->field); \ - else \ - debugfs_create_u64(#name, 0400, sta->debugfs_dir, \ - (u64 *) &sta->field); + debugfs_create_ulong(#name, 0400, sta->debugfs_dir, &sta->field); void ieee80211_sta_debugfs_add(struct sta_info *sta) { @@ -978,14 +973,8 @@ void ieee80211_sta_debugfs_add(struct sta_info *sta) NL80211_EXT_FEATURE_AIRTIME_FAIRNESS)) DEBUGFS_ADD(airtime); - if (sizeof(sta->driver_buffered_tids) == sizeof(u32)) - debugfs_create_x32("driver_buffered_tids", 0400, - sta->debugfs_dir, - (u32 *)&sta->driver_buffered_tids); - else - debugfs_create_x64("driver_buffered_tids", 0400, - sta->debugfs_dir, - (u64 *)&sta->driver_buffered_tids); + debugfs_create_xul("driver_buffered_tids", 0400, sta->debugfs_dir, + &sta->driver_buffered_tids); drv_sta_add_debugfs(local, sdata, &sta->sta, sta->debugfs_dir); } From patchwork Fri Oct 25 09:41:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 11212007 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 63F4F1390 for ; Fri, 25 Oct 2019 11:09:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4BD5C2084C for ; Fri, 25 Oct 2019 11:09:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503103AbfJYLJ3 (ORCPT ); Fri, 25 Oct 2019 07:09:29 -0400 Received: from andre.telenet-ops.be ([195.130.132.53]:34280 "EHLO andre.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502573AbfJYLIp (ORCPT ); Fri, 25 Oct 2019 07:08:45 -0400 Received: from ramsan ([84.195.182.253]) by andre.telenet-ops.be with bizsmtp id Hn8b2100B5USYZQ01n8bdK; Fri, 25 Oct 2019 13:08:43 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1iNxSN-0003rD-9j; Fri, 25 Oct 2019 13:08:35 +0200 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1iNw6A-0006mw-LI; Fri, 25 Oct 2019 11:41:34 +0200 From: Geert Uytterhoeven To: Jonathan Corbet , Greg Kroah-Hartman , Ludovic Desroches , Ulf Hansson , Nicolas Ferre , Alexandre Belloni , Jaehoon Chung , "David S . Miller" , "Rafael J . Wysocki" , Johannes Berg Cc: linux-doc@vger.kernel.org, linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2 3/7] net: caif: Fix debugfs on 64-bit platforms Date: Fri, 25 Oct 2019 11:41:26 +0200 Message-Id: <20191025094130.26033-4-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191025094130.26033-1-geert+renesas@glider.be> References: <20191025094130.26033-1-geert+renesas@glider.be> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org "ser_device.state" is "unsigned long", i.e. 32-bit or 64-bit, depending on the platform. Hence casting its address to "u32 *", and calling debugfs_create_x32() breaks operation on 64-bit platforms. Fix this by using the new debugfs_create_xul() helper instead. Fixes: 9b27105b4a44c54b ("net-caif-driver: add CAIF serial driver (ldisc)") Signed-off-by: Geert Uytterhoeven --- v2: - No changes. --- drivers/net/caif/caif_serial.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c index 40b079162804fb0c..bd40b114d6cd7214 100644 --- a/drivers/net/caif/caif_serial.c +++ b/drivers/net/caif/caif_serial.c @@ -102,8 +102,8 @@ static inline void debugfs_init(struct ser_device *ser, struct tty_struct *tty) debugfs_create_blob("last_rx_msg", 0400, ser->debugfs_tty_dir, &ser->rx_blob); - debugfs_create_x32("ser_state", 0400, ser->debugfs_tty_dir, - (u32 *)&ser->state); + debugfs_create_xul("ser_state", 0400, ser->debugfs_tty_dir, + &ser->state); debugfs_create_x8("tty_status", 0400, ser->debugfs_tty_dir, &ser->tty_status); From patchwork Fri Oct 25 09:41:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 11211997 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D431E1390 for ; Fri, 25 Oct 2019 11:09:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B26C421D81 for ; Fri, 25 Oct 2019 11:09:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503304AbfJYLIr (ORCPT ); Fri, 25 Oct 2019 07:08:47 -0400 Received: from xavier.telenet-ops.be ([195.130.132.52]:36626 "EHLO xavier.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503163AbfJYLIr (ORCPT ); Fri, 25 Oct 2019 07:08:47 -0400 Received: from ramsan ([84.195.182.253]) by xavier.telenet-ops.be with bizsmtp id Hn8b2100H5USYZQ01n8bm9; Fri, 25 Oct 2019 13:08:46 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1iNxSN-0003rD-78; Fri, 25 Oct 2019 13:08:35 +0200 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1iNw6A-0006n1-MM; Fri, 25 Oct 2019 11:41:34 +0200 From: Geert Uytterhoeven To: Jonathan Corbet , Greg Kroah-Hartman , Ludovic Desroches , Ulf Hansson , Nicolas Ferre , Alexandre Belloni , Jaehoon Chung , "David S . Miller" , "Rafael J . Wysocki" , Johannes Berg Cc: linux-doc@vger.kernel.org, linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2 4/7] mmc: atmel-mci: Fix debugfs on 64-bit platforms Date: Fri, 25 Oct 2019 11:41:27 +0200 Message-Id: <20191025094130.26033-5-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191025094130.26033-1-geert+renesas@glider.be> References: <20191025094130.26033-1-geert+renesas@glider.be> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org "atmel_mci.pending_events" and "atmel_mci.completed_events" are "unsigned long", i.e. 32-bit or 64-bit, depending on the platform. Hence casting their addresses to "u32 *", and calling debugfs_create_x32() breaks operation on 64-bit platforms. Fix this by using the new debugfs_create_xul() helper instead. Fixes: deec9ae31e607955 ("atmel-mci: debugfs support") Signed-off-by: Geert Uytterhoeven Acked-by: Ulf Hansson --- v2: - Add Acked-by. --- drivers/mmc/host/atmel-mci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index c26fbe5f22221d95..ef2eb9e7c75a32a1 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c @@ -584,10 +584,10 @@ static void atmci_init_debugfs(struct atmel_mci_slot *slot) debugfs_create_file("regs", S_IRUSR, root, host, &atmci_regs_fops); debugfs_create_file("req", S_IRUSR, root, slot, &atmci_req_fops); debugfs_create_u32("state", S_IRUSR, root, (u32 *)&host->state); - debugfs_create_x32("pending_events", S_IRUSR, root, - (u32 *)&host->pending_events); - debugfs_create_x32("completed_events", S_IRUSR, root, - (u32 *)&host->completed_events); + debugfs_create_xul("pending_events", S_IRUSR, root, + &host->pending_events); + debugfs_create_xul("completed_events", S_IRUSR, root, + &host->completed_events); } #if defined(CONFIG_OF) From patchwork Fri Oct 25 09:41:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 11212001 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C7DE114ED for ; Fri, 25 Oct 2019 11:09:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B06D02084C for ; Fri, 25 Oct 2019 11:09:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503261AbfJYLJT (ORCPT ); Fri, 25 Oct 2019 07:09:19 -0400 Received: from xavier.telenet-ops.be ([195.130.132.52]:36566 "EHLO xavier.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503129AbfJYLIr (ORCPT ); Fri, 25 Oct 2019 07:08:47 -0400 Received: from ramsan ([84.195.182.253]) by xavier.telenet-ops.be with bizsmtp id Hn8b210045USYZQ01n8bm6; Fri, 25 Oct 2019 13:08:46 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1iNxSM-0003rD-VJ; Fri, 25 Oct 2019 13:08:34 +0200 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1iNw6A-0006n4-NF; Fri, 25 Oct 2019 11:41:34 +0200 From: Geert Uytterhoeven To: Jonathan Corbet , Greg Kroah-Hartman , Ludovic Desroches , Ulf Hansson , Nicolas Ferre , Alexandre Belloni , Jaehoon Chung , "David S . Miller" , "Rafael J . Wysocki" , Johannes Berg Cc: linux-doc@vger.kernel.org, linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2 5/7] mmc: atmel-mci: Remove superfluous cast in debugfs_create_u32() call Date: Fri, 25 Oct 2019 11:41:28 +0200 Message-Id: <20191025094130.26033-6-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191025094130.26033-1-geert+renesas@glider.be> References: <20191025094130.26033-1-geert+renesas@glider.be> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org "atmel_mci.state" is an enum, which is compatible with u32, so there is no need to cast its address, preventing further compiler checks. Signed-off-by: Geert Uytterhoeven Acked-by: Ulf Hansson --- v2: - Add Acked-by. --- drivers/mmc/host/atmel-mci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index ef2eb9e7c75a32a1..34c992d875298932 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c @@ -583,7 +583,7 @@ static void atmci_init_debugfs(struct atmel_mci_slot *slot) debugfs_create_file("regs", S_IRUSR, root, host, &atmci_regs_fops); debugfs_create_file("req", S_IRUSR, root, slot, &atmci_req_fops); - debugfs_create_u32("state", S_IRUSR, root, (u32 *)&host->state); + debugfs_create_u32("state", S_IRUSR, root, &host->state); debugfs_create_xul("pending_events", S_IRUSR, root, &host->pending_events); debugfs_create_xul("completed_events", S_IRUSR, root, From patchwork Fri Oct 25 09:41:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 11211979 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 96A9E14ED for ; Fri, 25 Oct 2019 11:08:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7D7DA21D7F for ; Fri, 25 Oct 2019 11:08:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503225AbfJYLIv (ORCPT ); Fri, 25 Oct 2019 07:08:51 -0400 Received: from andre.telenet-ops.be ([195.130.132.53]:34164 "EHLO andre.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503186AbfJYLIu (ORCPT ); Fri, 25 Oct 2019 07:08:50 -0400 Received: from ramsan ([84.195.182.253]) by andre.telenet-ops.be with bizsmtp id Hn8b210055USYZQ01n8bdL; Fri, 25 Oct 2019 13:08:50 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1iNxSN-0003rD-4F; Fri, 25 Oct 2019 13:08:35 +0200 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1iNw6A-0006n7-O6; Fri, 25 Oct 2019 11:41:34 +0200 From: Geert Uytterhoeven To: Jonathan Corbet , Greg Kroah-Hartman , Ludovic Desroches , Ulf Hansson , Nicolas Ferre , Alexandre Belloni , Jaehoon Chung , "David S . Miller" , "Rafael J . Wysocki" , Johannes Berg Cc: linux-doc@vger.kernel.org, linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2 6/7] mmc: dw_mmc: Fix debugfs on 64-bit platforms Date: Fri, 25 Oct 2019 11:41:29 +0200 Message-Id: <20191025094130.26033-7-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191025094130.26033-1-geert+renesas@glider.be> References: <20191025094130.26033-1-geert+renesas@glider.be> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org "dw_mci.pending_events" and "dw_mci.completed_events" are "unsigned long", i.e. 32-bit or 64-bit, depending on the platform. Hence casting their addresses to "u32 *", and calling debugfs_create_x32() breaks operation on 64-bit platforms. Fix this by using the new debugfs_create_xul() helper instead. Fixes: f95f3850f7a9e1d4 ("mmc: dw_mmc: Add Synopsys DesignWare mmc host driver.") Signed-off-by: Geert Uytterhoeven Acked-by: Ulf Hansson --- v2: - Add Acked-by. --- drivers/mmc/host/dw_mmc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index bf0048ebbda356a7..b4c4a9cd6365f122 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -177,10 +177,10 @@ static void dw_mci_init_debugfs(struct dw_mci_slot *slot) debugfs_create_file("regs", S_IRUSR, root, host, &dw_mci_regs_fops); debugfs_create_file("req", S_IRUSR, root, slot, &dw_mci_req_fops); debugfs_create_u32("state", S_IRUSR, root, (u32 *)&host->state); - debugfs_create_x32("pending_events", S_IRUSR, root, - (u32 *)&host->pending_events); - debugfs_create_x32("completed_events", S_IRUSR, root, - (u32 *)&host->completed_events); + debugfs_create_xul("pending_events", S_IRUSR, root, + &host->pending_events); + debugfs_create_xul("completed_events", S_IRUSR, root, + &host->completed_events); } #endif /* defined(CONFIG_DEBUG_FS) */ From patchwork Fri Oct 25 09:41:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 11211999 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DCD1D14ED for ; Fri, 25 Oct 2019 11:09:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C578521D71 for ; Fri, 25 Oct 2019 11:09:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438971AbfJYLJN (ORCPT ); Fri, 25 Oct 2019 07:09:13 -0400 Received: from baptiste.telenet-ops.be ([195.130.132.51]:55420 "EHLO baptiste.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503270AbfJYLIr (ORCPT ); Fri, 25 Oct 2019 07:08:47 -0400 Received: from ramsan ([84.195.182.253]) by baptiste.telenet-ops.be with bizsmtp id Hn8b210045USYZQ01n8b1h; Fri, 25 Oct 2019 13:08:46 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1iNxSN-0003rD-1k; Fri, 25 Oct 2019 13:08:35 +0200 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1iNw6A-0006nA-Oz; Fri, 25 Oct 2019 11:41:34 +0200 From: Geert Uytterhoeven To: Jonathan Corbet , Greg Kroah-Hartman , Ludovic Desroches , Ulf Hansson , Nicolas Ferre , Alexandre Belloni , Jaehoon Chung , "David S . Miller" , "Rafael J . Wysocki" , Johannes Berg Cc: linux-doc@vger.kernel.org, linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2 7/7] mmc: dw_mmc: Remove superfluous cast in debugfs_create_u32() call Date: Fri, 25 Oct 2019 11:41:30 +0200 Message-Id: <20191025094130.26033-8-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191025094130.26033-1-geert+renesas@glider.be> References: <20191025094130.26033-1-geert+renesas@glider.be> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org "dw_mci.state" is an enum, which is compatible with u32, so there is no need to cast its address, preventing further compiler checks. Signed-off-by: Geert Uytterhoeven Acked-by: Ulf Hansson --- v2: - Add Acked-by. --- drivers/mmc/host/dw_mmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index b4c4a9cd6365f122..fc9d4d000f97e434 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -176,7 +176,7 @@ static void dw_mci_init_debugfs(struct dw_mci_slot *slot) debugfs_create_file("regs", S_IRUSR, root, host, &dw_mci_regs_fops); debugfs_create_file("req", S_IRUSR, root, slot, &dw_mci_req_fops); - debugfs_create_u32("state", S_IRUSR, root, (u32 *)&host->state); + debugfs_create_u32("state", S_IRUSR, root, &host->state); debugfs_create_xul("pending_events", S_IRUSR, root, &host->pending_events); debugfs_create_xul("completed_events", S_IRUSR, root,