Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: syscon: Remove the platform driver support

The platform driver is dead code. It is not used by DT platforms since
commit bdb0066df96e ("mfd: syscon: Decouple syscon interface from
platform devices") which said:

For non-DT based platforms, this patch keeps syscon platform driver
structure so that syscon can be probed and such non-DT based drivers
can use syscon_regmap_lookup_by_pdev API and access regmap handles.
Once all users of "syscon_regmap_lookup_by_pdev" migrated to DT based,
we can completely remove platform driver of syscon, and keep only helper
functions to get regmap handles.

The last user of syscon_regmap_lookup_by_pdevname() was removed in 2018.
syscon_regmap_lookup_by_pdevname() was then removed in 2019, but that
commit failed to remove the rest of the platform driver.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Tested-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Tested-by: Will McVicker <willmcvicker@google.com>
Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Reviewed-by: Pankaj Dubey <pankaj.dubey@samsung.com>
Tested-by: Pankaj Dubey <pankaj.dubey@samsung.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20241217-syscon-fixes-v2-2-4f56d750541d@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Rob Herring (Arm) and committed by
Lee Jones
26769582 805f7aaf

-76
-66
drivers/mfd/syscon.c
··· 12 12 #include <linux/clk.h> 13 13 #include <linux/err.h> 14 14 #include <linux/hwspinlock.h> 15 - #include <linux/io.h> 16 - #include <linux/init.h> 17 15 #include <linux/list.h> 18 16 #include <linux/mutex.h> 19 17 #include <linux/of.h> 20 18 #include <linux/of_address.h> 21 - #include <linux/of_platform.h> 22 - #include <linux/platform_data/syscon.h> 23 - #include <linux/platform_device.h> 24 19 #include <linux/regmap.h> 25 20 #include <linux/reset.h> 26 21 #include <linux/mfd/syscon.h> 27 22 #include <linux/slab.h> 28 - 29 - static struct platform_driver syscon_driver; 30 23 31 24 static DEFINE_MUTEX(syscon_list_lock); 32 25 static LIST_HEAD(syscon_list); ··· 330 337 return regmap; 331 338 } 332 339 EXPORT_SYMBOL_GPL(syscon_regmap_lookup_by_phandle_optional); 333 - 334 - static int syscon_probe(struct platform_device *pdev) 335 - { 336 - struct device *dev = &pdev->dev; 337 - struct syscon_platform_data *pdata = dev_get_platdata(dev); 338 - struct syscon *syscon; 339 - struct regmap_config syscon_config = syscon_regmap_config; 340 - struct resource *res; 341 - void __iomem *base; 342 - 343 - syscon = devm_kzalloc(dev, sizeof(*syscon), GFP_KERNEL); 344 - if (!syscon) 345 - return -ENOMEM; 346 - 347 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 348 - if (!res) 349 - return -ENOENT; 350 - 351 - base = devm_ioremap(dev, res->start, resource_size(res)); 352 - if (!base) 353 - return -ENOMEM; 354 - 355 - syscon_config.max_register = resource_size(res) - 4; 356 - if (!syscon_config.max_register) 357 - syscon_config.max_register_is_0 = true; 358 - 359 - if (pdata) 360 - syscon_config.name = pdata->label; 361 - syscon->regmap = devm_regmap_init_mmio(dev, base, &syscon_config); 362 - if (IS_ERR(syscon->regmap)) { 363 - dev_err(dev, "regmap init failed\n"); 364 - return PTR_ERR(syscon->regmap); 365 - } 366 - 367 - platform_set_drvdata(pdev, syscon); 368 - 369 - dev_dbg(dev, "regmap %pR registered\n", res); 370 - 371 - return 0; 372 - } 373 - 374 - static const struct platform_device_id syscon_ids[] = { 375 - { "syscon", }, 376 - { } 377 - }; 378 - 379 - static struct platform_driver syscon_driver = { 380 - .driver = { 381 - .name = "syscon", 382 - }, 383 - .probe = syscon_probe, 384 - .id_table = syscon_ids, 385 - }; 386 - 387 - static int __init syscon_init(void) 388 - { 389 - return platform_driver_register(&syscon_driver); 390 - } 391 - postcore_initcall(syscon_init);
-1
drivers/mfd/vexpress-sysreg.c
··· 10 10 #include <linux/mfd/core.h> 11 11 #include <linux/module.h> 12 12 #include <linux/of_platform.h> 13 - #include <linux/platform_data/syscon.h> 14 13 #include <linux/platform_device.h> 15 14 #include <linux/slab.h> 16 15 #include <linux/stat.h>
-9
include/linux/platform_data/syscon.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef PLATFORM_DATA_SYSCON_H 3 - #define PLATFORM_DATA_SYSCON_H 4 - 5 - struct syscon_platform_data { 6 - const char *label; 7 - }; 8 - 9 - #endif