Skip to contentSkip to conversation

mmc: mmc_spi: Drop duplicate 'mmc_spi' in the debug messages

PATCH In review Andy Shevchenko 2 participants 4 messages May 28, 2021 – May 31, 2021

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

PATCH 1/2 mmc: mmc_spi: Drop duplicate 'mmc_spi' in the debug messages

dev_dbg() in any case prints the device and driver name, no need to repeat this in (some) messages. Drop duplicates for good.

---
 drivers/mmc/host/mmc_spi.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/mmc/host/mmc_spi.c +5 -7
index 9776a03a10f5..65c65bb5737f 100644
@@ -504,7 +504,7 @@ mmc_spi_command_send(struct mmc_spi_host *host,
 		/* else:  R1 (most commands) */
 	}
 
-	dev_dbg(&host->spi->dev, "  mmc_spi: CMD%d, resp %s\n",
+	dev_dbg(&host->spi->dev, "  CMD%d, resp %s\n",
 		cmd->opcode, maptype(cmd));
 
 	/* send command, leaving chipselect active */
@@ -928,8 +928,7 @@ mmc_spi_data_do(struct mmc_spi_host *host, struct mmc_command *cmd,
 		while (length) {
 			t->len = min(length, blk_size);
 
-			dev_dbg(&host->spi->dev,
-				"    mmc_spi: %s block, %d bytes\n",
+			dev_dbg(&host->spi->dev, "    %s block, %d bytes\n",
 				(direction == DMA_TO_DEVICE) ? "write" : "read",
 				t->len);
 
@@ -974,7 +973,7 @@ mmc_spi_data_do(struct mmc_spi_host *host, struct mmc_command *cmd,
 		int		tmp;
 		const unsigned	statlen = sizeof(scratch->status);
 
-		dev_dbg(&spi->dev, "    mmc_spi: STOP_TRAN\n");
+		dev_dbg(&spi->dev, "    STOP_TRAN\n");
 
 		/* Tweak the per-block message we set up earlier by morphing
 		 * it to hold single buffer with the token followed by some
@@ -1175,7 +1174,7 @@ static void mmc_spi_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 
 		canpower = host->pdata && host->pdata->setpower;
 
-		dev_dbg(&host->spi->dev, "mmc_spi: power %s (%d)%s\n",
+		dev_dbg(&host->spi->dev, "power %s (%d)%s\n",
 				mmc_powerstring(ios->power_mode),
 				ios->vdd,
 				canpower ? ", can switch" : "");
@@ -1248,8 +1247,7 @@ static void mmc_spi_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 
 		host->spi->max_speed_hz = ios->clock;
 		status = spi_setup(host->spi);
-		dev_dbg(&host->spi->dev,
-			"mmc_spi:  clock to %d Hz, %d\n",
+		dev_dbg(&host->spi->dev, "  clock to %d Hz, %d\n",
 			host->spi->max_speed_hz, status);
 	}
 }
Signature · 1 line
2.30.2
#1 lore raw

PATCH 2/2 mmc: mmc_spi: Imply container_of() to be no-op

Since we don't use structure field layout randomization the manual shuffling can affect some macros, in particular container_of() against struct of_mmc_spi, which becomes a no-op when pdata member is the first one in the structure.

---
 drivers/mmc/host/of_mmc_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/of_mmc_spi.c +1 -1
index 9d480a05f655..3629550528b6 100644
@@ -22,8 +22,8 @@
 MODULE_LICENSE("GPL");
 
 struct of_mmc_spi {
-	int detect_irq;
 	struct mmc_spi_platform_data pdata;
+	int detect_irq;
 };
 
 static struct of_mmc_spi *to_of_mmc_spi(struct device *dev)
Signature · 1 line
2.30.2
#3 lore raw
In reply to Andy Shevchenko
Quoted 5 lines · Andy Shevchenko

dev_dbg() in any case prints the device and driver name, no need to repeat this in (some) messages. Drop duplicates for good.

Applied for next, thanks!

Kind regards
Uffe

Quoted 58 lines
---
 drivers/mmc/host/mmc_spi.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/mmc/host/mmc_spi.c +5 -8
index 9776a03a10f5..65c65bb5737f 100644
@@ -504,7 +504,7 @@ mmc_spi_command_send(struct mmc_spi_host *host,
                /* else:  R1 (most commands) */
        }
 
-       dev_dbg(&host->spi->dev, "  mmc_spi: CMD%d, resp %s\n",
+       dev_dbg(&host->spi->dev, "  CMD%d, resp %s\n",
                cmd->opcode, maptype(cmd));
 
        /* send command, leaving chipselect active */
@@ -928,8 +928,7 @@ mmc_spi_data_do(struct mmc_spi_host *host, struct mmc_command *cmd,
                while (length) {
                        t->len = min(length, blk_size);
 
-                       dev_dbg(&host->spi->dev,
-                               "    mmc_spi: %s block, %d bytes\n",
+                       dev_dbg(&host->spi->dev, "    %s block, %d bytes\n",
                                (direction == DMA_TO_DEVICE) ? "write" : "read",
                                t->len);
 
@@ -974,7 +973,7 @@ mmc_spi_data_do(struct mmc_spi_host *host, struct mmc_command *cmd,
                int             tmp;
                const unsigned  statlen = sizeof(scratch->status);
 
-               dev_dbg(&spi->dev, "    mmc_spi: STOP_TRAN\n");
+               dev_dbg(&spi->dev, "    STOP_TRAN\n");
 
                /* Tweak the per-block message we set up earlier by morphing
                 * it to hold single buffer with the token followed by some
@@ -1175,7 +1174,7 @@ static void mmc_spi_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 
                canpower = host->pdata && host->pdata->setpower;
 
-               dev_dbg(&host->spi->dev, "mmc_spi: power %s (%d)%s\n",
+               dev_dbg(&host->spi->dev, "power %s (%d)%s\n",
                                mmc_powerstring(ios->power_mode),
                                ios->vdd,
                                canpower ? ", can switch" : "");
@@ -1248,8 +1247,7 @@ static void mmc_spi_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 
                host->spi->max_speed_hz = ios->clock;
                status = spi_setup(host->spi);
-               dev_dbg(&host->spi->dev,
-                       "mmc_spi:  clock to %d Hz, %d\n",
+               dev_dbg(&host->spi->dev, "  clock to %d Hz, %d\n",
                        host->spi->max_speed_hz, status);
        }
 }
--

2.30.2

#2 lore raw

Re: [PATCH v1 2/2] mmc: mmc_spi: Imply container_of() to be no-op

In reply to Andy Shevchenko
Quoted 7 lines · Andy Shevchenko

Since we don't use structure field layout randomization the manual shuffling can affect some macros, in particular container_of() against struct of_mmc_spi, which becomes a no-op when pdata member is the first one in the structure.

Applied for next, thanks!

Kind regards
Uffe

Quoted 21 lines
---
 drivers/mmc/host/of_mmc_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/of_mmc_spi.c +1 -2
index 9d480a05f655..3629550528b6 100644
@@ -22,8 +22,8 @@
 MODULE_LICENSE("GPL");
 
 struct of_mmc_spi {
-       int detect_irq;
        struct mmc_spi_platform_data pdata;
+       int detect_irq;
 };
 
 static struct of_mmc_spi *to_of_mmc_spi(struct device *dev)
--

2.30.2