Skip to contentSkip to conversation

mmc: use octal file permissions instead of symbolic

PATCH In review Pedro Demarchi Gomes 3 participants 4 messages Oct 2, 2025 – Oct 17, 2025

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: use octal file permissions instead of symbolic

As stated in Documentation/dev-tools/checkpatch.rst, octal file permissions are preferred over symbolic constants because they are easier to read and understand. Replace symbolic permissions with their octal equivalents.

---
 drivers/mmc/core/block.c       |  6 +++---
 drivers/mmc/core/bus.h         |  2 +-
 drivers/mmc/core/mmc.c         |  4 ++--
 drivers/mmc/core/mmc_test.c    |  4 ++--
 drivers/mmc/core/sd.c          |  2 +-
 drivers/mmc/host/atmel-mci.c   | 10 +++++-----
 drivers/mmc/host/davinci_mmc.c |  6 +++---
 drivers/mmc/host/dw_mmc.c      | 10 +++++-----
 drivers/mmc/host/omap.c        |  4 ++--
 drivers/mmc/host/omap_hsmmc.c  |  4 ++--
 10 files changed, 26 insertions(+), 26 deletions(-)
drivers/mmc/core/block.c +3 -3
index 9cc47bf94804..78dc1a9ca2ef 100644
@@ -387,10 +387,10 @@ static umode_t mmc_disk_attrs_is_visible(struct kobject *kobj,
 	if (a == &dev_attr_ro_lock_until_next_power_on.attr &&
 	    (md->area_type & MMC_BLK_DATA_AREA_BOOT) &&
 	    md->queue.card->ext_csd.boot_ro_lockable) {
-		mode = S_IRUGO;
+		mode = 0444;
 		if (!(md->queue.card->ext_csd.boot_ro_lock &
 				EXT_CSD_BOOT_WP_B_PWR_WP_DIS))
-			mode |= S_IWUSR;
+			mode |= 0200;
 	}
 
 	mmc_blk_put(md);
@@ -3244,7 +3244,7 @@ static void mmc_blk_add_debugfs(struct mmc_card *card, struct mmc_blk_data *md)
 
 	if (mmc_card_mmc(card)) {
 		md->ext_csd_dentry =
-			debugfs_create_file("ext_csd", S_IRUSR, root, card,
+			debugfs_create_file("ext_csd", 0400, root, card,
 					    &mmc_dbg_ext_csd_fops);
 	}
 }
drivers/mmc/core/bus.h +1 -1
index cfd0d02d3420..8b69624fa46e 100644
@@ -20,7 +20,7 @@ static ssize_t mmc_##name##_show (struct device *dev, struct device_attribute *a
 	struct mmc_card *card = mmc_dev_to_card(dev);				\
 	return sysfs_emit(buf, fmt, args);					\
 }										\
-static DEVICE_ATTR(name, S_IRUGO, mmc_##name##_show, NULL)
+static DEVICE_ATTR(name, 0444, mmc_##name##_show, NULL)
 
 struct mmc_card *mmc_alloc_card(struct mmc_host *host,
 				const struct device_type *type);
drivers/mmc/core/mmc.c +2 -2
index 5be9b42d5057..e4b7829469ea 100644
@@ -830,7 +830,7 @@ static ssize_t mmc_fwrev_show(struct device *dev,
 				  card->ext_csd.fwrev);
 }
 
-static DEVICE_ATTR(fwrev, S_IRUGO, mmc_fwrev_show, NULL);
+static DEVICE_ATTR(fwrev, 0444, mmc_fwrev_show, NULL);
 
 static ssize_t mmc_dsr_show(struct device *dev,
 			    struct device_attribute *attr,
@@ -846,7 +846,7 @@ static ssize_t mmc_dsr_show(struct device *dev,
 		return sysfs_emit(buf, "0x%x\n", 0x404);
 }
 
-static DEVICE_ATTR(dsr, S_IRUGO, mmc_dsr_show, NULL);
+static DEVICE_ATTR(dsr, 0444, mmc_dsr_show, NULL);
 
 static struct attribute *mmc_std_attrs[] = {
 	&dev_attr_cid.attr,
drivers/mmc/core/mmc_test.c +2 -2
index 80e5d87a5e50..62b4983c1ef5 100644
@@ -3218,12 +3218,12 @@ static int mmc_test_register_dbgfs_file(struct mmc_card *card)
 
 	mutex_lock(&mmc_test_lock);
 
-	ret = __mmc_test_register_dbgfs_file(card, "test", S_IWUSR | S_IRUGO,
+	ret = __mmc_test_register_dbgfs_file(card, "test", 0644,
 		&mmc_test_fops_test);
 	if (ret)
 		goto err;
 
-	ret = __mmc_test_register_dbgfs_file(card, "testlist", S_IRUGO,
+	ret = __mmc_test_register_dbgfs_file(card, "testlist", 0444,
 		&mtf_testlist_fops);
 	if (ret)
 		goto err;
drivers/mmc/core/sd.c +1 -1
index ec02067f03c5..5ed6bc47f1c4 100644
@@ -744,7 +744,7 @@ static ssize_t mmc_dsr_show(struct device *dev, struct device_attribute *attr,
 	return sysfs_emit(buf, "0x%x\n", 0x404);
 }
 
-static DEVICE_ATTR(dsr, S_IRUGO, mmc_dsr_show, NULL);
+static DEVICE_ATTR(dsr, 0444, mmc_dsr_show, NULL);
 
 MMC_DEV_ATTR(vendor, "0x%04x\n", card->cis.vendor);
 MMC_DEV_ATTR(device, "0x%04x\n", card->cis.device);
drivers/mmc/host/atmel-mci.c +5 -5
index 777342fb7657..d4a504f0aded 100644
@@ -609,12 +609,12 @@ static void atmci_init_debugfs(struct atmel_mci_slot *slot)
 	if (!root)
 		return;
 
-	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, &host->state);
-	debugfs_create_xul("pending_events", S_IRUSR, root,
+	debugfs_create_file("regs", 0400, root, host, &atmci_regs_fops);
+	debugfs_create_file("req", 0400, root, slot, &atmci_req_fops);
+	debugfs_create_u32("state", 0400, root, &host->state);
+	debugfs_create_xul("pending_events", 0400, root,
 			   &host->pending_events);
-	debugfs_create_xul("completed_events", S_IRUSR, root,
+	debugfs_create_xul("completed_events", 0400, root,
 			   &host->completed_events);
 }
 
drivers/mmc/host/davinci_mmc.c +3 -3
index c691f1b60395..3174e7ac65b3 100644
@@ -145,17 +145,17 @@
 #define MAX_NR_SG	16
 
 static unsigned rw_threshold = 32;
-module_param(rw_threshold, uint, S_IRUGO);
+module_param(rw_threshold, uint, 0444);
 MODULE_PARM_DESC(rw_threshold,
 		"Read/Write threshold. Default = 32");
 
 static unsigned poll_threshold = 128;
-module_param(poll_threshold, uint, S_IRUGO);
+module_param(poll_threshold, uint, 0444);
 MODULE_PARM_DESC(poll_threshold,
 		 "Polling transaction size threshold. Default = 128");
 
 static unsigned poll_loopcount = 32;
-module_param(poll_loopcount, uint, S_IRUGO);
+module_param(poll_loopcount, uint, 0444);
 MODULE_PARM_DESC(poll_loopcount,
 		 "Maximum polling loop count. Default = 32");
 
drivers/mmc/host/dw_mmc.c +5 -5
index c5db92bbb094..2380ab82812a 100644
@@ -175,12 +175,12 @@ static void dw_mci_init_debugfs(struct dw_mci_slot *slot)
 	if (!root)
 		return;
 
-	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, &host->state);
-	debugfs_create_xul("pending_events", S_IRUSR, root,
+	debugfs_create_file("regs", 0400, root, host, &dw_mci_regs_fops);
+	debugfs_create_file("req", 0400, root, slot, &dw_mci_req_fops);
+	debugfs_create_u32("state", 0400, root, &host->state);
+	debugfs_create_xul("pending_events", 0400, root,
 			   &host->pending_events);
-	debugfs_create_xul("completed_events", S_IRUSR, root,
+	debugfs_create_xul("completed_events", 0400, root,
 			   &host->completed_events);
 #ifdef CONFIG_FAULT_INJECTION
 	fault_create_debugfs_attr("fail_data_crc", root, &host->fail_data_crc);
drivers/mmc/host/omap.c +2 -2
index 52ac3f128a1c..5fc7d6d722b7 100644
@@ -326,7 +326,7 @@ mmc_omap_show_cover_switch(struct device *dev, struct device_attribute *attr,
 		       "closed");
 }
 
-static DEVICE_ATTR(cover_switch, S_IRUGO, mmc_omap_show_cover_switch, NULL);
+static DEVICE_ATTR(cover_switch, 0444, mmc_omap_show_cover_switch, NULL);
 
 static ssize_t
 mmc_omap_show_slot_name(struct device *dev, struct device_attribute *attr,
@@ -338,7 +338,7 @@ mmc_omap_show_slot_name(struct device *dev, struct device_attribute *attr,
 	return sprintf(buf, "%s\n", slot->pdata->name);
 }
 
-static DEVICE_ATTR(slot_name, S_IRUGO, mmc_omap_show_slot_name, NULL);
+static DEVICE_ATTR(slot_name, 0444, mmc_omap_show_slot_name, NULL);
 
 static void
 mmc_omap_start_command(struct mmc_omap_host *host, struct mmc_command *cmd)
drivers/mmc/host/omap_hsmmc.c +2 -2
index adc0d0b6ae37..5c679b795af1 100644
@@ -747,7 +747,7 @@ omap_hsmmc_show_slot_name(struct device *dev, struct device_attribute *attr,
 	return sprintf(buf, "%s\n", mmc_pdata(host)->name);
 }
 
-static DEVICE_ATTR(slot_name, S_IRUGO, omap_hsmmc_show_slot_name, NULL);
+static DEVICE_ATTR(slot_name, 0444, omap_hsmmc_show_slot_name, NULL);
 
 /*
  * Configure the response type and send the cmd.
@@ -1673,7 +1673,7 @@ DEFINE_SHOW_ATTRIBUTE(mmc_regs);
 static void omap_hsmmc_debugfs(struct mmc_host *mmc)
 {
 	if (mmc->debugfs_root)
-		debugfs_create_file("regs", S_IRUSR, mmc->debugfs_root,
+		debugfs_create_file("regs", 0400, mmc->debugfs_root,
 			mmc, &mmc_regs_fops);
 }
 
Signature · 1 line
2.39.5
maintainer
#1 lore raw
Quoted 5 lines · Pedro Demarchi Gomes

As stated in Documentation/dev-tools/checkpatch.rst, octal file permissions are preferred over symbolic constants because they are easier to read and understand. Replace symbolic permissions with their octal equivalents.

Quoted 8 lines
---
  drivers/mmc/core/block.c       |  6 +++---
  drivers/mmc/core/bus.h         |  2 +-
  drivers/mmc/core/mmc.c         |  4 ++--
  drivers/mmc/core/mmc_test.c    |  4 ++--
  drivers/mmc/core/sd.c          |  2 +-
  drivers/mmc/host/atmel-mci.c   | 10 +++++-----

Each driver may require its dedicated patch and dedicated subject, may not it?

Quoted 215 lines
  drivers/mmc/host/davinci_mmc.c |  6 +++---
  drivers/mmc/host/dw_mmc.c      | 10 +++++-----
  drivers/mmc/host/omap.c        |  4 ++--
  drivers/mmc/host/omap_hsmmc.c  |  4 ++--
  10 files changed, 26 insertions(+), 26 deletions(-)
drivers/mmc/core/block.c +3 -3
index 9cc47bf94804..78dc1a9ca2ef 100644
@@ -387,10 +387,10 @@ static umode_t mmc_disk_attrs_is_visible(struct kobject *kobj,
         if (a == &dev_attr_ro_lock_until_next_power_on.attr &&
             (md->area_type & MMC_BLK_DATA_AREA_BOOT) &&
             md->queue.card->ext_csd.boot_ro_lockable) {
-               mode = S_IRUGO;
+               mode = 0444;
                 if (!(md->queue.card->ext_csd.boot_ro_lock &
                                 EXT_CSD_BOOT_WP_B_PWR_WP_DIS))
-                       mode |= S_IWUSR;
+                       mode |= 0200;
         }
 
         mmc_blk_put(md);
@@ -3244,7 +3244,7 @@ static void mmc_blk_add_debugfs(struct mmc_card *card, struct mmc_blk_data *md)
 
         if (mmc_card_mmc(card)) {
                 md->ext_csd_dentry =
-                       debugfs_create_file("ext_csd", S_IRUSR, root, card,
+                       debugfs_create_file("ext_csd", 0400, root, card,
                                             &mmc_dbg_ext_csd_fops);
         }
  }
drivers/mmc/core/bus.h +1 -1
index cfd0d02d3420..8b69624fa46e 100644
@@ -20,7 +20,7 @@ static ssize_t mmc_##name##_show (struct device *dev, struct device_attribute *a
         struct mmc_card *card = mmc_dev_to_card(dev);                           \
         return sysfs_emit(buf, fmt, args);                                      \
  }                                                                              \
-static DEVICE_ATTR(name, S_IRUGO, mmc_##name##_show, NULL)
+static DEVICE_ATTR(name, 0444, mmc_##name##_show, NULL)
 
  struct mmc_card *mmc_alloc_card(struct mmc_host *host,
                                 const struct device_type *type);
drivers/mmc/core/mmc.c +2 -2
index 5be9b42d5057..e4b7829469ea 100644
@@ -830,7 +830,7 @@ static ssize_t mmc_fwrev_show(struct device *dev,
                                   card->ext_csd.fwrev);
  }
 
-static DEVICE_ATTR(fwrev, S_IRUGO, mmc_fwrev_show, NULL);
+static DEVICE_ATTR(fwrev, 0444, mmc_fwrev_show, NULL);
 
  static ssize_t mmc_dsr_show(struct device *dev,
                             struct device_attribute *attr,
@@ -846,7 +846,7 @@ static ssize_t mmc_dsr_show(struct device *dev,
                 return sysfs_emit(buf, "0x%x\n", 0x404);
  }
 
-static DEVICE_ATTR(dsr, S_IRUGO, mmc_dsr_show, NULL);
+static DEVICE_ATTR(dsr, 0444, mmc_dsr_show, NULL);
 
  static struct attribute *mmc_std_attrs[] = {
         &dev_attr_cid.attr,
drivers/mmc/core/mmc_test.c +2 -2
index 80e5d87a5e50..62b4983c1ef5 100644
@@ -3218,12 +3218,12 @@ static int mmc_test_register_dbgfs_file(struct mmc_card *card)
 
         mutex_lock(&mmc_test_lock);
 
-       ret = __mmc_test_register_dbgfs_file(card, "test", S_IWUSR | S_IRUGO,
+       ret = __mmc_test_register_dbgfs_file(card, "test", 0644,
                 &mmc_test_fops_test);
         if (ret)
                 goto err;
 
-       ret = __mmc_test_register_dbgfs_file(card, "testlist", S_IRUGO,
+       ret = __mmc_test_register_dbgfs_file(card, "testlist", 0444,
                 &mtf_testlist_fops);
         if (ret)
                 goto err;
drivers/mmc/core/sd.c +1 -1
index ec02067f03c5..5ed6bc47f1c4 100644
@@ -744,7 +744,7 @@ static ssize_t mmc_dsr_show(struct device *dev, struct device_attribute *attr,
         return sysfs_emit(buf, "0x%x\n", 0x404);
  }
 
-static DEVICE_ATTR(dsr, S_IRUGO, mmc_dsr_show, NULL);
+static DEVICE_ATTR(dsr, 0444, mmc_dsr_show, NULL);
 
  MMC_DEV_ATTR(vendor, "0x%04x\n", card->cis.vendor);
  MMC_DEV_ATTR(device, "0x%04x\n", card->cis.device);
drivers/mmc/host/atmel-mci.c +5 -5
index 777342fb7657..d4a504f0aded 100644
@@ -609,12 +609,12 @@ static void atmci_init_debugfs(struct atmel_mci_slot *slot)
         if (!root)
                 return;
 
-       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, &host->state);
-       debugfs_create_xul("pending_events", S_IRUSR, root,
+       debugfs_create_file("regs", 0400, root, host, &atmci_regs_fops);
+       debugfs_create_file("req", 0400, root, slot, &atmci_req_fops);
+       debugfs_create_u32("state", 0400, root, &host->state);
+       debugfs_create_xul("pending_events", 0400, root,
                            &host->pending_events);
-       debugfs_create_xul("completed_events", S_IRUSR, root,
+       debugfs_create_xul("completed_events", 0400, root,
                            &host->completed_events);
  }
 
drivers/mmc/host/davinci_mmc.c +3 -3
index c691f1b60395..3174e7ac65b3 100644
@@ -145,17 +145,17 @@
  #define MAX_NR_SG      16
 
  static unsigned rw_threshold = 32;
-module_param(rw_threshold, uint, S_IRUGO);
+module_param(rw_threshold, uint, 0444);
  MODULE_PARM_DESC(rw_threshold,
                 "Read/Write threshold. Default = 32");
 
  static unsigned poll_threshold = 128;
-module_param(poll_threshold, uint, S_IRUGO);
+module_param(poll_threshold, uint, 0444);
  MODULE_PARM_DESC(poll_threshold,
                  "Polling transaction size threshold. Default = 128");
 
  static unsigned poll_loopcount = 32;
-module_param(poll_loopcount, uint, S_IRUGO);
+module_param(poll_loopcount, uint, 0444);
  MODULE_PARM_DESC(poll_loopcount,
                  "Maximum polling loop count. Default = 32");
 
drivers/mmc/host/dw_mmc.c +5 -5
index c5db92bbb094..2380ab82812a 100644
@@ -175,12 +175,12 @@ static void dw_mci_init_debugfs(struct dw_mci_slot *slot)
         if (!root)
                 return;
 
-       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, &host->state);
-       debugfs_create_xul("pending_events", S_IRUSR, root,
+       debugfs_create_file("regs", 0400, root, host, &dw_mci_regs_fops);
+       debugfs_create_file("req", 0400, root, slot, &dw_mci_req_fops);
+       debugfs_create_u32("state", 0400, root, &host->state);
+       debugfs_create_xul("pending_events", 0400, root,
                            &host->pending_events);
-       debugfs_create_xul("completed_events", S_IRUSR, root,
+       debugfs_create_xul("completed_events", 0400, root,
                            &host->completed_events);
  #ifdef CONFIG_FAULT_INJECTION
         fault_create_debugfs_attr("fail_data_crc", root, &host->fail_data_crc);
drivers/mmc/host/omap.c +2 -2
index 52ac3f128a1c..5fc7d6d722b7 100644
@@ -326,7 +326,7 @@ mmc_omap_show_cover_switch(struct device *dev, struct device_attribute *attr,
                        "closed");
  }
 
-static DEVICE_ATTR(cover_switch, S_IRUGO, mmc_omap_show_cover_switch, NULL);
+static DEVICE_ATTR(cover_switch, 0444, mmc_omap_show_cover_switch, NULL);
 
  static ssize_t
  mmc_omap_show_slot_name(struct device *dev, struct device_attribute *attr,
@@ -338,7 +338,7 @@ mmc_omap_show_slot_name(struct device *dev, struct device_attribute *attr,
         return sprintf(buf, "%s\n", slot->pdata->name);
  }
 
-static DEVICE_ATTR(slot_name, S_IRUGO, mmc_omap_show_slot_name, NULL);
+static DEVICE_ATTR(slot_name, 0444, mmc_omap_show_slot_name, NULL);
 
  static void
  mmc_omap_start_command(struct mmc_omap_host *host, struct mmc_command *cmd)
drivers/mmc/host/omap_hsmmc.c +2 -3
index adc0d0b6ae37..5c679b795af1 100644
@@ -747,7 +747,7 @@ omap_hsmmc_show_slot_name(struct device *dev, struct device_attribute *attr,
         return sprintf(buf, "%s\n", mmc_pdata(host)->name);
  }
 
-static DEVICE_ATTR(slot_name, S_IRUGO, omap_hsmmc_show_slot_name, NULL);
+static DEVICE_ATTR(slot_name, 0444, omap_hsmmc_show_slot_name, NULL);
 
  /*
   * Configure the response type and send the cmd.
@@ -1673,7 +1673,7 @@ DEFINE_SHOW_ATTRIBUTE(mmc_regs);
  static void omap_hsmmc_debugfs(struct mmc_host *mmc)
  {
         if (mmc->debugfs_root)
-               debugfs_create_file("regs", S_IRUSR, mmc->debugfs_root,
+               debugfs_create_file("regs", 0400, mmc->debugfs_root,
                         mmc, &mmc_regs_fops);
  }
 
--

2.39.5

#2 lore raw
Quoted 16 lines · Aubin Constans
Quoted 5 lines · Pedro Demarchi Gomes

As stated in Documentation/dev-tools/checkpatch.rst, octal file permissions are preferred over symbolic constants because they are easier to read and understand. Replace symbolic permissions with their octal equivalents.

Quoted 8 lines
---
  drivers/mmc/core/block.c       |  6 +++---
  drivers/mmc/core/bus.h         |  2 +-
  drivers/mmc/core/mmc.c         |  4 ++--
  drivers/mmc/core/mmc_test.c    |  4 ++--
  drivers/mmc/core/sd.c          |  2 +-
  drivers/mmc/host/atmel-mci.c   | 10 +++++-----
Quoted 1 line

Each driver may require its dedicated patch and dedicated subject, may not it?

Yes, in general this is the preferred way. However, when it comes to more trivial clean-up patches, I think one bigger patch works better.

Kind regards
Uffe

Quoted 217 lines
Quoted 216 lines
  drivers/mmc/host/davinci_mmc.c |  6 +++---
  drivers/mmc/host/dw_mmc.c      | 10 +++++-----
  drivers/mmc/host/omap.c        |  4 ++--
  drivers/mmc/host/omap_hsmmc.c  |  4 ++--
  10 files changed, 26 insertions(+), 26 deletions(-)
drivers/mmc/core/block.c +3 -3
index 9cc47bf94804..78dc1a9ca2ef 100644
@@ -387,10 +387,10 @@ static umode_t mmc_disk_attrs_is_visible(struct kobject *kobj,
         if (a == &dev_attr_ro_lock_until_next_power_on.attr &&
             (md->area_type & MMC_BLK_DATA_AREA_BOOT) &&
             md->queue.card->ext_csd.boot_ro_lockable) {
-               mode = S_IRUGO;
+               mode = 0444;
                 if (!(md->queue.card->ext_csd.boot_ro_lock &
                                 EXT_CSD_BOOT_WP_B_PWR_WP_DIS))
-                       mode |= S_IWUSR;
+                       mode |= 0200;
         }
 
         mmc_blk_put(md);
@@ -3244,7 +3244,7 @@ static void mmc_blk_add_debugfs(struct mmc_card *card, struct mmc_blk_data *md)
 
         if (mmc_card_mmc(card)) {
                 md->ext_csd_dentry =
-                       debugfs_create_file("ext_csd", S_IRUSR, root, card,
+                       debugfs_create_file("ext_csd", 0400, root, card,
                                             &mmc_dbg_ext_csd_fops);
         }
  }
drivers/mmc/core/bus.h +1 -1
index cfd0d02d3420..8b69624fa46e 100644
@@ -20,7 +20,7 @@ static ssize_t mmc_##name##_show (struct device *dev, struct device_attribute *a
         struct mmc_card *card = mmc_dev_to_card(dev);                           \
         return sysfs_emit(buf, fmt, args);                                      \
  }                                                                              \
-static DEVICE_ATTR(name, S_IRUGO, mmc_##name##_show, NULL)
+static DEVICE_ATTR(name, 0444, mmc_##name##_show, NULL)
 
  struct mmc_card *mmc_alloc_card(struct mmc_host *host,
                                 const struct device_type *type);
drivers/mmc/core/mmc.c +2 -2
index 5be9b42d5057..e4b7829469ea 100644
@@ -830,7 +830,7 @@ static ssize_t mmc_fwrev_show(struct device *dev,
                                   card->ext_csd.fwrev);
  }
 
-static DEVICE_ATTR(fwrev, S_IRUGO, mmc_fwrev_show, NULL);
+static DEVICE_ATTR(fwrev, 0444, mmc_fwrev_show, NULL);
 
  static ssize_t mmc_dsr_show(struct device *dev,
                             struct device_attribute *attr,
@@ -846,7 +846,7 @@ static ssize_t mmc_dsr_show(struct device *dev,
                 return sysfs_emit(buf, "0x%x\n", 0x404);
  }
 
-static DEVICE_ATTR(dsr, S_IRUGO, mmc_dsr_show, NULL);
+static DEVICE_ATTR(dsr, 0444, mmc_dsr_show, NULL);
 
  static struct attribute *mmc_std_attrs[] = {
         &dev_attr_cid.attr,
drivers/mmc/core/mmc_test.c +2 -2
index 80e5d87a5e50..62b4983c1ef5 100644
@@ -3218,12 +3218,12 @@ static int mmc_test_register_dbgfs_file(struct mmc_card *card)
 
         mutex_lock(&mmc_test_lock);
 
-       ret = __mmc_test_register_dbgfs_file(card, "test", S_IWUSR | S_IRUGO,
+       ret = __mmc_test_register_dbgfs_file(card, "test", 0644,
                 &mmc_test_fops_test);
         if (ret)
                 goto err;
 
-       ret = __mmc_test_register_dbgfs_file(card, "testlist", S_IRUGO,
+       ret = __mmc_test_register_dbgfs_file(card, "testlist", 0444,
                 &mtf_testlist_fops);
         if (ret)
                 goto err;
drivers/mmc/core/sd.c +1 -1
index ec02067f03c5..5ed6bc47f1c4 100644
@@ -744,7 +744,7 @@ static ssize_t mmc_dsr_show(struct device *dev, struct device_attribute *attr,
         return sysfs_emit(buf, "0x%x\n", 0x404);
  }
 
-static DEVICE_ATTR(dsr, S_IRUGO, mmc_dsr_show, NULL);
+static DEVICE_ATTR(dsr, 0444, mmc_dsr_show, NULL);
 
  MMC_DEV_ATTR(vendor, "0x%04x\n", card->cis.vendor);
  MMC_DEV_ATTR(device, "0x%04x\n", card->cis.device);
drivers/mmc/host/atmel-mci.c +5 -5
index 777342fb7657..d4a504f0aded 100644
@@ -609,12 +609,12 @@ static void atmci_init_debugfs(struct atmel_mci_slot *slot)
         if (!root)
                 return;
 
-       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, &host->state);
-       debugfs_create_xul("pending_events", S_IRUSR, root,
+       debugfs_create_file("regs", 0400, root, host, &atmci_regs_fops);
+       debugfs_create_file("req", 0400, root, slot, &atmci_req_fops);
+       debugfs_create_u32("state", 0400, root, &host->state);
+       debugfs_create_xul("pending_events", 0400, root,
                            &host->pending_events);
-       debugfs_create_xul("completed_events", S_IRUSR, root,
+       debugfs_create_xul("completed_events", 0400, root,
                            &host->completed_events);
  }
 
drivers/mmc/host/davinci_mmc.c +3 -3
index c691f1b60395..3174e7ac65b3 100644
@@ -145,17 +145,17 @@
  #define MAX_NR_SG      16
 
  static unsigned rw_threshold = 32;
-module_param(rw_threshold, uint, S_IRUGO);
+module_param(rw_threshold, uint, 0444);
  MODULE_PARM_DESC(rw_threshold,
                 "Read/Write threshold. Default = 32");
 
  static unsigned poll_threshold = 128;
-module_param(poll_threshold, uint, S_IRUGO);
+module_param(poll_threshold, uint, 0444);
  MODULE_PARM_DESC(poll_threshold,
                  "Polling transaction size threshold. Default = 128");
 
  static unsigned poll_loopcount = 32;
-module_param(poll_loopcount, uint, S_IRUGO);
+module_param(poll_loopcount, uint, 0444);
  MODULE_PARM_DESC(poll_loopcount,
                  "Maximum polling loop count. Default = 32");
 
drivers/mmc/host/dw_mmc.c +5 -5
index c5db92bbb094..2380ab82812a 100644
@@ -175,12 +175,12 @@ static void dw_mci_init_debugfs(struct dw_mci_slot *slot)
         if (!root)
                 return;
 
-       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, &host->state);
-       debugfs_create_xul("pending_events", S_IRUSR, root,
+       debugfs_create_file("regs", 0400, root, host, &dw_mci_regs_fops);
+       debugfs_create_file("req", 0400, root, slot, &dw_mci_req_fops);
+       debugfs_create_u32("state", 0400, root, &host->state);
+       debugfs_create_xul("pending_events", 0400, root,
                            &host->pending_events);
-       debugfs_create_xul("completed_events", S_IRUSR, root,
+       debugfs_create_xul("completed_events", 0400, root,
                            &host->completed_events);
  #ifdef CONFIG_FAULT_INJECTION
         fault_create_debugfs_attr("fail_data_crc", root, &host->fail_data_crc);
drivers/mmc/host/omap.c +2 -2
index 52ac3f128a1c..5fc7d6d722b7 100644
@@ -326,7 +326,7 @@ mmc_omap_show_cover_switch(struct device *dev, struct device_attribute *attr,
                        "closed");
  }
 
-static DEVICE_ATTR(cover_switch, S_IRUGO, mmc_omap_show_cover_switch, NULL);
+static DEVICE_ATTR(cover_switch, 0444, mmc_omap_show_cover_switch, NULL);
 
  static ssize_t
  mmc_omap_show_slot_name(struct device *dev, struct device_attribute *attr,
@@ -338,7 +338,7 @@ mmc_omap_show_slot_name(struct device *dev, struct device_attribute *attr,
         return sprintf(buf, "%s\n", slot->pdata->name);
  }
 
-static DEVICE_ATTR(slot_name, S_IRUGO, mmc_omap_show_slot_name, NULL);
+static DEVICE_ATTR(slot_name, 0444, mmc_omap_show_slot_name, NULL);
 
  static void
  mmc_omap_start_command(struct mmc_omap_host *host, struct mmc_command *cmd)
drivers/mmc/host/omap_hsmmc.c +2 -3
index adc0d0b6ae37..5c679b795af1 100644
@@ -747,7 +747,7 @@ omap_hsmmc_show_slot_name(struct device *dev, struct device_attribute *attr,
         return sprintf(buf, "%s\n", mmc_pdata(host)->name);
  }
 
-static DEVICE_ATTR(slot_name, S_IRUGO, omap_hsmmc_show_slot_name, NULL);
+static DEVICE_ATTR(slot_name, 0444, omap_hsmmc_show_slot_name, NULL);
 
  /*
   * Configure the response type and send the cmd.
@@ -1673,7 +1673,7 @@ DEFINE_SHOW_ATTRIBUTE(mmc_regs);
  static void omap_hsmmc_debugfs(struct mmc_host *mmc)
  {
         if (mmc->debugfs_root)
-               debugfs_create_file("regs", S_IRUSR, mmc->debugfs_root,
+               debugfs_create_file("regs", 0400, mmc->debugfs_root,
                         mmc, &mmc_regs_fops);
  }
 
--

2.39.5

#3 lore raw
In reply to Pedro Demarchi Gomes
Quoted 7 lines · Pedro Demarchi Gomes

As stated in Documentation/dev-tools/checkpatch.rst, octal file permissions are preferred over symbolic constants because they are easier to read and understand. Replace symbolic permissions with their octal equivalents.

Applied for next, thanks!

Kind regards
Uffe

Quoted 222 lines
---
 drivers/mmc/core/block.c       |  6 +++---
 drivers/mmc/core/bus.h         |  2 +-
 drivers/mmc/core/mmc.c         |  4 ++--
 drivers/mmc/core/mmc_test.c    |  4 ++--
 drivers/mmc/core/sd.c          |  2 +-
 drivers/mmc/host/atmel-mci.c   | 10 +++++-----
 drivers/mmc/host/davinci_mmc.c |  6 +++---
 drivers/mmc/host/dw_mmc.c      | 10 +++++-----
 drivers/mmc/host/omap.c        |  4 ++--
 drivers/mmc/host/omap_hsmmc.c  |  4 ++--
 10 files changed, 26 insertions(+), 26 deletions(-)
drivers/mmc/core/block.c +3 -3
index 9cc47bf94804..78dc1a9ca2ef 100644
@@ -387,10 +387,10 @@ static umode_t mmc_disk_attrs_is_visible(struct kobject *kobj,
        if (a == &dev_attr_ro_lock_until_next_power_on.attr &&
            (md->area_type & MMC_BLK_DATA_AREA_BOOT) &&
            md->queue.card->ext_csd.boot_ro_lockable) {
-               mode = S_IRUGO;
+               mode = 0444;
                if (!(md->queue.card->ext_csd.boot_ro_lock &
                                EXT_CSD_BOOT_WP_B_PWR_WP_DIS))
-                       mode |= S_IWUSR;
+                       mode |= 0200;
        }
 
        mmc_blk_put(md);
@@ -3244,7 +3244,7 @@ static void mmc_blk_add_debugfs(struct mmc_card *card, struct mmc_blk_data *md)
 
        if (mmc_card_mmc(card)) {
                md->ext_csd_dentry =
-                       debugfs_create_file("ext_csd", S_IRUSR, root, card,
+                       debugfs_create_file("ext_csd", 0400, root, card,
                                            &mmc_dbg_ext_csd_fops);
        }
 }
drivers/mmc/core/bus.h +1 -1
index cfd0d02d3420..8b69624fa46e 100644
@@ -20,7 +20,7 @@ static ssize_t mmc_##name##_show (struct device *dev, struct device_attribute *a
        struct mmc_card *card = mmc_dev_to_card(dev);                           \
        return sysfs_emit(buf, fmt, args);                                      \
 }                                                                              \
-static DEVICE_ATTR(name, S_IRUGO, mmc_##name##_show, NULL)
+static DEVICE_ATTR(name, 0444, mmc_##name##_show, NULL)
 
 struct mmc_card *mmc_alloc_card(struct mmc_host *host,
                                const struct device_type *type);
drivers/mmc/core/mmc.c +2 -2
index 5be9b42d5057..e4b7829469ea 100644
@@ -830,7 +830,7 @@ static ssize_t mmc_fwrev_show(struct device *dev,
                                  card->ext_csd.fwrev);
 }
 
-static DEVICE_ATTR(fwrev, S_IRUGO, mmc_fwrev_show, NULL);
+static DEVICE_ATTR(fwrev, 0444, mmc_fwrev_show, NULL);
 
 static ssize_t mmc_dsr_show(struct device *dev,
                            struct device_attribute *attr,
@@ -846,7 +846,7 @@ static ssize_t mmc_dsr_show(struct device *dev,
                return sysfs_emit(buf, "0x%x\n", 0x404);
 }
 
-static DEVICE_ATTR(dsr, S_IRUGO, mmc_dsr_show, NULL);
+static DEVICE_ATTR(dsr, 0444, mmc_dsr_show, NULL);
 
 static struct attribute *mmc_std_attrs[] = {
        &dev_attr_cid.attr,
drivers/mmc/core/mmc_test.c +2 -2
index 80e5d87a5e50..62b4983c1ef5 100644
@@ -3218,12 +3218,12 @@ static int mmc_test_register_dbgfs_file(struct mmc_card *card)
 
        mutex_lock(&mmc_test_lock);
 
-       ret = __mmc_test_register_dbgfs_file(card, "test", S_IWUSR | S_IRUGO,
+       ret = __mmc_test_register_dbgfs_file(card, "test", 0644,
                &mmc_test_fops_test);
        if (ret)
                goto err;
 
-       ret = __mmc_test_register_dbgfs_file(card, "testlist", S_IRUGO,
+       ret = __mmc_test_register_dbgfs_file(card, "testlist", 0444,
                &mtf_testlist_fops);
        if (ret)
                goto err;
drivers/mmc/core/sd.c +1 -1
index ec02067f03c5..5ed6bc47f1c4 100644
@@ -744,7 +744,7 @@ static ssize_t mmc_dsr_show(struct device *dev, struct device_attribute *attr,
        return sysfs_emit(buf, "0x%x\n", 0x404);
 }
 
-static DEVICE_ATTR(dsr, S_IRUGO, mmc_dsr_show, NULL);
+static DEVICE_ATTR(dsr, 0444, mmc_dsr_show, NULL);
 
 MMC_DEV_ATTR(vendor, "0x%04x\n", card->cis.vendor);
 MMC_DEV_ATTR(device, "0x%04x\n", card->cis.device);
drivers/mmc/host/atmel-mci.c +5 -5
index 777342fb7657..d4a504f0aded 100644
@@ -609,12 +609,12 @@ static void atmci_init_debugfs(struct atmel_mci_slot *slot)
        if (!root)
                return;
 
-       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, &host->state);
-       debugfs_create_xul("pending_events", S_IRUSR, root,
+       debugfs_create_file("regs", 0400, root, host, &atmci_regs_fops);
+       debugfs_create_file("req", 0400, root, slot, &atmci_req_fops);
+       debugfs_create_u32("state", 0400, root, &host->state);
+       debugfs_create_xul("pending_events", 0400, root,
                           &host->pending_events);
-       debugfs_create_xul("completed_events", S_IRUSR, root,
+       debugfs_create_xul("completed_events", 0400, root,
                           &host->completed_events);
 }
 
drivers/mmc/host/davinci_mmc.c +3 -3
index c691f1b60395..3174e7ac65b3 100644
@@ -145,17 +145,17 @@
 #define MAX_NR_SG      16
 
 static unsigned rw_threshold = 32;
-module_param(rw_threshold, uint, S_IRUGO);
+module_param(rw_threshold, uint, 0444);
 MODULE_PARM_DESC(rw_threshold,
                "Read/Write threshold. Default = 32");
 
 static unsigned poll_threshold = 128;
-module_param(poll_threshold, uint, S_IRUGO);
+module_param(poll_threshold, uint, 0444);
 MODULE_PARM_DESC(poll_threshold,
                 "Polling transaction size threshold. Default = 128");
 
 static unsigned poll_loopcount = 32;
-module_param(poll_loopcount, uint, S_IRUGO);
+module_param(poll_loopcount, uint, 0444);
 MODULE_PARM_DESC(poll_loopcount,
                 "Maximum polling loop count. Default = 32");
 
drivers/mmc/host/dw_mmc.c +5 -5
index c5db92bbb094..2380ab82812a 100644
@@ -175,12 +175,12 @@ static void dw_mci_init_debugfs(struct dw_mci_slot *slot)
        if (!root)
                return;
 
-       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, &host->state);
-       debugfs_create_xul("pending_events", S_IRUSR, root,
+       debugfs_create_file("regs", 0400, root, host, &dw_mci_regs_fops);
+       debugfs_create_file("req", 0400, root, slot, &dw_mci_req_fops);
+       debugfs_create_u32("state", 0400, root, &host->state);
+       debugfs_create_xul("pending_events", 0400, root,
                           &host->pending_events);
-       debugfs_create_xul("completed_events", S_IRUSR, root,
+       debugfs_create_xul("completed_events", 0400, root,
                           &host->completed_events);
 #ifdef CONFIG_FAULT_INJECTION
        fault_create_debugfs_attr("fail_data_crc", root, &host->fail_data_crc);
drivers/mmc/host/omap.c +2 -2
index 52ac3f128a1c..5fc7d6d722b7 100644
@@ -326,7 +326,7 @@ mmc_omap_show_cover_switch(struct device *dev, struct device_attribute *attr,
                       "closed");
 }
 
-static DEVICE_ATTR(cover_switch, S_IRUGO, mmc_omap_show_cover_switch, NULL);
+static DEVICE_ATTR(cover_switch, 0444, mmc_omap_show_cover_switch, NULL);
 
 static ssize_t
 mmc_omap_show_slot_name(struct device *dev, struct device_attribute *attr,
@@ -338,7 +338,7 @@ mmc_omap_show_slot_name(struct device *dev, struct device_attribute *attr,
        return sprintf(buf, "%s\n", slot->pdata->name);
 }
 
-static DEVICE_ATTR(slot_name, S_IRUGO, mmc_omap_show_slot_name, NULL);
+static DEVICE_ATTR(slot_name, 0444, mmc_omap_show_slot_name, NULL);
 
 static void
 mmc_omap_start_command(struct mmc_omap_host *host, struct mmc_command *cmd)
drivers/mmc/host/omap_hsmmc.c +2 -3
index adc0d0b6ae37..5c679b795af1 100644
@@ -747,7 +747,7 @@ omap_hsmmc_show_slot_name(struct device *dev, struct device_attribute *attr,
        return sprintf(buf, "%s\n", mmc_pdata(host)->name);
 }
 
-static DEVICE_ATTR(slot_name, S_IRUGO, omap_hsmmc_show_slot_name, NULL);
+static DEVICE_ATTR(slot_name, 0444, omap_hsmmc_show_slot_name, NULL);
 
 /*
  * Configure the response type and send the cmd.
@@ -1673,7 +1673,7 @@ DEFINE_SHOW_ATTRIBUTE(mmc_regs);
 static void omap_hsmmc_debugfs(struct mmc_host *mmc)
 {
        if (mmc->debugfs_root)
-               debugfs_create_file("regs", S_IRUSR, mmc->debugfs_root,
+               debugfs_create_file("regs", 0400, mmc->debugfs_root,
                        mmc, &mmc_regs_fops);
 }
 
--

2.39.5