Skip to content

Commit d22ee15

Browse files
committed
Merge tag 'memory-controller-drv-6.9' of https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-mem-ctrl into soc/drivers
Memory controller drivers for v6.9 1. TI EMIF: Simplify handling CONFIG_DEBUG_FS, CONFIG_OF and platform_driver_probe(). 2. Narrow regex in Nvidia Tegra20 EMC binding. * tag 'memory-controller-drv-6.9' of https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-mem-ctrl: dt-bindings: memory-controllers: narrow regex for unit address to hex numbers memory: emif: Drop usage of platform_driver_probe() memory: emif: Simplify code handling CONFIG_OF memory: emif: Simplify code handling CONFIG_DEBUG_FS Link: https://lore.kernel.org/r/20240218183046.32721-1-krzysztof.kozlowski@linaro.org Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2 parents b256c24 + 2f542c9 commit d22ee15

2 files changed

Lines changed: 25 additions & 42 deletions

File tree

Documentation/devicetree/bindings/memory-controllers/nvidia,tegra20-emc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ patternProperties:
145145
"^emc-table@[0-9]+$":
146146
$ref: "#/$defs/emc-table"
147147

148-
"^emc-tables@[a-z0-9-]+$":
148+
"^emc-tables@[a-f0-9-]+$":
149149
type: object
150150
properties:
151151
reg:

drivers/memory/emif.c

Lines changed: 24 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ static DEFINE_SPINLOCK(emif_lock);
7272
static unsigned long irq_state;
7373
static LIST_HEAD(device_list);
7474

75-
#ifdef CONFIG_DEBUG_FS
7675
static void do_emif_regdump_show(struct seq_file *s, struct emif_data *emif,
7776
struct emif_regs *regs)
7877
{
@@ -140,31 +139,24 @@ static int emif_mr4_show(struct seq_file *s, void *unused)
140139

141140
DEFINE_SHOW_ATTRIBUTE(emif_mr4);
142141

143-
static int __init_or_module emif_debugfs_init(struct emif_data *emif)
142+
static void emif_debugfs_init(struct emif_data *emif)
144143
{
145-
emif->debugfs_root = debugfs_create_dir(dev_name(emif->dev), NULL);
146-
debugfs_create_file("regcache_dump", S_IRUGO, emif->debugfs_root, emif,
147-
&emif_regdump_fops);
148-
debugfs_create_file("mr4", S_IRUGO, emif->debugfs_root, emif,
149-
&emif_mr4_fops);
150-
return 0;
151-
}
152-
153-
static void __exit emif_debugfs_exit(struct emif_data *emif)
154-
{
155-
debugfs_remove_recursive(emif->debugfs_root);
156-
emif->debugfs_root = NULL;
157-
}
158-
#else
159-
static inline int __init_or_module emif_debugfs_init(struct emif_data *emif)
160-
{
161-
return 0;
144+
if (IS_ENABLED(CONFIG_DEBUG_FS)) {
145+
emif->debugfs_root = debugfs_create_dir(dev_name(emif->dev), NULL);
146+
debugfs_create_file("regcache_dump", S_IRUGO, emif->debugfs_root, emif,
147+
&emif_regdump_fops);
148+
debugfs_create_file("mr4", S_IRUGO, emif->debugfs_root, emif,
149+
&emif_mr4_fops);
150+
}
162151
}
163152

164-
static inline void __exit emif_debugfs_exit(struct emif_data *emif)
153+
static void emif_debugfs_exit(struct emif_data *emif)
165154
{
155+
if (IS_ENABLED(CONFIG_DEBUG_FS)) {
156+
debugfs_remove_recursive(emif->debugfs_root);
157+
emif->debugfs_root = NULL;
158+
}
166159
}
167-
#endif
168160

169161
/*
170162
* Get bus width used by EMIF. Note that this may be different from the
@@ -679,7 +671,7 @@ static void disable_and_clear_all_interrupts(struct emif_data *emif)
679671
clear_all_interrupts(emif);
680672
}
681673

682-
static int __init_or_module setup_interrupts(struct emif_data *emif, u32 irq)
674+
static int setup_interrupts(struct emif_data *emif, u32 irq)
683675
{
684676
u32 interrupts, type;
685677
void __iomem *base = emif->base;
@@ -710,7 +702,7 @@ static int __init_or_module setup_interrupts(struct emif_data *emif, u32 irq)
710702

711703
}
712704

713-
static void __init_or_module emif_onetime_settings(struct emif_data *emif)
705+
static void emif_onetime_settings(struct emif_data *emif)
714706
{
715707
u32 pwr_mgmt_ctrl, zq, temp_alert_cfg;
716708
void __iomem *base = emif->base;
@@ -834,8 +826,7 @@ static int is_custom_config_valid(struct emif_custom_configs *cust_cfgs,
834826
return valid;
835827
}
836828

837-
#if defined(CONFIG_OF)
838-
static void __init_or_module of_get_custom_configs(struct device_node *np_emif,
829+
static void of_get_custom_configs(struct device_node *np_emif,
839830
struct emif_data *emif)
840831
{
841832
struct emif_custom_configs *cust_cfgs = NULL;
@@ -884,7 +875,7 @@ static void __init_or_module of_get_custom_configs(struct device_node *np_emif,
884875
emif->plat_data->custom_configs = cust_cfgs;
885876
}
886877

887-
static void __init_or_module of_get_ddr_info(struct device_node *np_emif,
878+
static void of_get_ddr_info(struct device_node *np_emif,
888879
struct device_node *np_ddr,
889880
struct ddr_device_info *dev_info)
890881
{
@@ -918,7 +909,7 @@ static void __init_or_module of_get_ddr_info(struct device_node *np_emif,
918909
dev_info->io_width = __fls(io_width) - 1;
919910
}
920911

921-
static struct emif_data * __init_or_module of_get_memory_device_details(
912+
static struct emif_data *of_get_memory_device_details(
922913
struct device_node *np_emif, struct device *dev)
923914
{
924915
struct emif_data *emif = NULL;
@@ -991,16 +982,7 @@ static struct emif_data * __init_or_module of_get_memory_device_details(
991982
return emif;
992983
}
993984

994-
#else
995-
996-
static struct emif_data * __init_or_module of_get_memory_device_details(
997-
struct device_node *np_emif, struct device *dev)
998-
{
999-
return NULL;
1000-
}
1001-
#endif
1002-
1003-
static struct emif_data *__init_or_module get_device_details(
985+
static struct emif_data *get_device_details(
1004986
struct platform_device *pdev)
1005987
{
1006988
u32 size;
@@ -1104,7 +1086,7 @@ static struct emif_data *__init_or_module get_device_details(
11041086
return NULL;
11051087
}
11061088

1107-
static int __init_or_module emif_probe(struct platform_device *pdev)
1089+
static int emif_probe(struct platform_device *pdev)
11081090
{
11091091
struct emif_data *emif;
11101092
int irq, ret;
@@ -1159,7 +1141,7 @@ static int __init_or_module emif_probe(struct platform_device *pdev)
11591141
return -ENODEV;
11601142
}
11611143

1162-
static void __exit emif_remove(struct platform_device *pdev)
1144+
static void emif_remove(struct platform_device *pdev)
11631145
{
11641146
struct emif_data *emif = platform_get_drvdata(pdev);
11651147

@@ -1183,15 +1165,16 @@ MODULE_DEVICE_TABLE(of, emif_of_match);
11831165
#endif
11841166

11851167
static struct platform_driver emif_driver = {
1186-
.remove_new = __exit_p(emif_remove),
1168+
.probe = emif_probe,
1169+
.remove_new = emif_remove,
11871170
.shutdown = emif_shutdown,
11881171
.driver = {
11891172
.name = "emif",
11901173
.of_match_table = of_match_ptr(emif_of_match),
11911174
},
11921175
};
11931176

1194-
module_platform_driver_probe(emif_driver, emif_probe);
1177+
module_platform_driver(emif_driver);
11951178

11961179
MODULE_DESCRIPTION("TI EMIF SDRAM Controller Driver");
11971180
MODULE_LICENSE("GPL");

0 commit comments

Comments
 (0)