Skip to content

Commit 68f5630

Browse files
rbmarlierestorulf
authored andcommitted
mmc: core: constify the struct device_type usage
Since commit aed65af ("drivers: make device_type const"), the driver core can properly handle constant struct device_type. Move the sdio_type, sd_type and mmc_type variables to be constant structures as well, placing it into read-only memory which can not be modified at runtime. Cc: Greg Kroah-Hartman <[email protected]> Signed-off-by: Ricardo B. Marliere <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 017199c commit 68f5630

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

drivers/mmc/core/bus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ static void mmc_release_card(struct device *dev)
272272
/*
273273
* Allocate and initialise a new MMC card structure.
274274
*/
275-
struct mmc_card *mmc_alloc_card(struct mmc_host *host, struct device_type *type)
275+
struct mmc_card *mmc_alloc_card(struct mmc_host *host, const struct device_type *type)
276276
{
277277
struct mmc_card *card;
278278

drivers/mmc/core/bus.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ static ssize_t mmc_##name##_show (struct device *dev, struct device_attribute *a
2323
static DEVICE_ATTR(name, S_IRUGO, mmc_##name##_show, NULL)
2424

2525
struct mmc_card *mmc_alloc_card(struct mmc_host *host,
26-
struct device_type *type);
26+
const struct device_type *type);
2727
int mmc_add_card(struct mmc_card *card);
2828
void mmc_remove_card(struct mmc_card *card);
2929

drivers/mmc/core/mmc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ static struct attribute *mmc_std_attrs[] = {
883883
};
884884
ATTRIBUTE_GROUPS(mmc_std);
885885

886-
static struct device_type mmc_type = {
886+
static const struct device_type mmc_type = {
887887
.groups = mmc_std_groups,
888888
};
889889

drivers/mmc/core/sd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ static const struct attribute_group sd_std_group = {
805805
};
806806
__ATTRIBUTE_GROUPS(sd_std);
807807

808-
struct device_type sd_type = {
808+
const struct device_type sd_type = {
809809
.groups = sd_std_groups,
810810
};
811811

drivers/mmc/core/sd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#include <linux/types.h>
66

7-
extern struct device_type sd_type;
7+
extern const struct device_type sd_type;
88

99
struct mmc_host;
1010
struct mmc_card;

drivers/mmc/core/sdio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ static struct attribute *sdio_std_attrs[] = {
6666
};
6767
ATTRIBUTE_GROUPS(sdio_std);
6868

69-
static struct device_type sdio_type = {
69+
static const struct device_type sdio_type = {
7070
.groups = sdio_std_groups,
7171
};
7272

0 commit comments

Comments
 (0)