Skip to content

Commit 80957ad

Browse files
committed
Merge tag 'ti-driver-soc-for-v6.7' of https://git.kernel.org/pub/scm/linux/kernel/git/ti/linux into soc/drivers
TI SoC driver updates for v6.7 - Generic fixups: Convert to platform remove callback returning void - ti_sci: Minor fixups and mark driver as non-removable - k3-socinfo: Documentation fixups, cosmetic fixups - knav_qmss_queue: Optimize with device_get_match_data Signed-off-by: Nishanth Menon <[email protected]> * tag 'ti-driver-soc-for-v6.7' of https://git.kernel.org/pub/scm/linux/kernel/git/ti/linux: soc: ti: k3-socinfo: Avoid overriding return value soc: ti: k3-socinfo: Fix typo in bitfield documentation soc: ti: knav_qmss_queue: Use device_get_match_data() firmware: ti_sci: Use device_get_match_data() soc/ti: wkup_m3_ipc: Convert to platform remove callback returning void soc/ti: smartreflex: Convert to platform remove callback returning void soc/ti: pruss: Convert to platform remove callback returning void soc/ti: pm33xx: Convert to platform remove callback returning void soc/ti: knav_qmss_queue: Convert to platform remove callback returning void soc/ti: knav_dma: Convert to platform remove callback returning void soc/ti: k3-ringacc: Convert to platform remove callback returning void firmware: ti_sci: Mark driver as non removable firmware: ti_sci: refactor deprecated strncpy firmware: ti_sci: Use list_for_each_entry() helper Link: https://lore.kernel.org/r/20231018165226.33x5cjn5jmgnm3di@magnolia Signed-off-by: Arnd Bergmann <[email protected]>
2 parents f1243fc + 3aeb0d3 commit 80957ad

File tree

9 files changed

+30
-92
lines changed

9 files changed

+30
-92
lines changed

drivers/firmware/ti_sci.c

Lines changed: 9 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
#include <linux/kernel.h>
1717
#include <linux/mailbox_client.h>
1818
#include <linux/module.h>
19-
#include <linux/of_device.h>
19+
#include <linux/of.h>
20+
#include <linux/of_platform.h>
21+
#include <linux/platform_device.h>
22+
#include <linux/property.h>
2023
#include <linux/semaphore.h>
2124
#include <linux/slab.h>
2225
#include <linux/soc/ti/ti-msgmgr.h>
@@ -190,19 +193,6 @@ static int ti_sci_debugfs_create(struct platform_device *pdev,
190193
return 0;
191194
}
192195

193-
/**
194-
* ti_sci_debugfs_destroy() - clean up log debug file
195-
* @pdev: platform device pointer
196-
* @info: Pointer to SCI entity information
197-
*/
198-
static void ti_sci_debugfs_destroy(struct platform_device *pdev,
199-
struct ti_sci_info *info)
200-
{
201-
if (IS_ERR(info->debug_region))
202-
return;
203-
204-
debugfs_remove(info->d);
205-
}
206196
#else /* CONFIG_DEBUG_FS */
207197
static inline int ti_sci_debugfs_create(struct platform_device *dev,
208198
struct ti_sci_info *info)
@@ -485,7 +475,7 @@ static int ti_sci_cmd_get_revision(struct ti_sci_info *info)
485475
ver->abi_major = rev_info->abi_major;
486476
ver->abi_minor = rev_info->abi_minor;
487477
ver->firmware_revision = rev_info->firmware_revision;
488-
strncpy(ver->firmware_description, rev_info->firmware_description,
478+
strscpy(ver->firmware_description, rev_info->firmware_description,
489479
sizeof(ver->firmware_description));
490480

491481
fail:
@@ -2886,7 +2876,6 @@ static void ti_sci_setup_ops(struct ti_sci_info *info)
28862876
const struct ti_sci_handle *ti_sci_get_handle(struct device *dev)
28872877
{
28882878
struct device_node *ti_sci_np;
2889-
struct list_head *p;
28902879
struct ti_sci_handle *handle = NULL;
28912880
struct ti_sci_info *info;
28922881

@@ -2901,8 +2890,7 @@ const struct ti_sci_handle *ti_sci_get_handle(struct device *dev)
29012890
}
29022891

29032892
mutex_lock(&ti_sci_list_mutex);
2904-
list_for_each(p, &ti_sci_list) {
2905-
info = list_entry(p, struct ti_sci_info, node);
2893+
list_for_each_entry(info, &ti_sci_list, node) {
29062894
if (ti_sci_np == info->dev->of_node) {
29072895
handle = &info->handle;
29082896
info->users++;
@@ -3012,7 +3000,6 @@ const struct ti_sci_handle *ti_sci_get_by_phandle(struct device_node *np,
30123000
struct ti_sci_handle *handle = NULL;
30133001
struct device_node *ti_sci_np;
30143002
struct ti_sci_info *info;
3015-
struct list_head *p;
30163003

30173004
if (!np) {
30183005
pr_err("I need a device pointer\n");
@@ -3024,8 +3011,7 @@ const struct ti_sci_handle *ti_sci_get_by_phandle(struct device_node *np,
30243011
return ERR_PTR(-ENODEV);
30253012

30263013
mutex_lock(&ti_sci_list_mutex);
3027-
list_for_each(p, &ti_sci_list) {
3028-
info = list_entry(p, struct ti_sci_info, node);
3014+
list_for_each_entry(info, &ti_sci_list, node) {
30293015
if (ti_sci_np == info->dev->of_node) {
30303016
handle = &info->handle;
30313017
info->users++;
@@ -3310,7 +3296,6 @@ MODULE_DEVICE_TABLE(of, ti_sci_of_match);
33103296
static int ti_sci_probe(struct platform_device *pdev)
33113297
{
33123298
struct device *dev = &pdev->dev;
3313-
const struct of_device_id *of_id;
33143299
const struct ti_sci_desc *desc;
33153300
struct ti_sci_xfer *xfer;
33163301
struct ti_sci_info *info = NULL;
@@ -3321,12 +3306,7 @@ static int ti_sci_probe(struct platform_device *pdev)
33213306
int reboot = 0;
33223307
u32 h_id;
33233308

3324-
of_id = of_match_device(ti_sci_of_match, dev);
3325-
if (!of_id) {
3326-
dev_err(dev, "OF data missing\n");
3327-
return -EINVAL;
3328-
}
3329-
desc = of_id->data;
3309+
desc = device_get_match_data(dev);
33303310

33313311
info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
33323312
if (!info)
@@ -3449,43 +3429,12 @@ static int ti_sci_probe(struct platform_device *pdev)
34493429
return ret;
34503430
}
34513431

3452-
static int ti_sci_remove(struct platform_device *pdev)
3453-
{
3454-
struct ti_sci_info *info;
3455-
struct device *dev = &pdev->dev;
3456-
int ret = 0;
3457-
3458-
of_platform_depopulate(dev);
3459-
3460-
info = platform_get_drvdata(pdev);
3461-
3462-
if (info->nb.notifier_call)
3463-
unregister_restart_handler(&info->nb);
3464-
3465-
mutex_lock(&ti_sci_list_mutex);
3466-
if (info->users)
3467-
ret = -EBUSY;
3468-
else
3469-
list_del(&info->node);
3470-
mutex_unlock(&ti_sci_list_mutex);
3471-
3472-
if (!ret) {
3473-
ti_sci_debugfs_destroy(pdev, info);
3474-
3475-
/* Safe to free channels since no more users */
3476-
mbox_free_channel(info->chan_tx);
3477-
mbox_free_channel(info->chan_rx);
3478-
}
3479-
3480-
return ret;
3481-
}
3482-
34833432
static struct platform_driver ti_sci_driver = {
34843433
.probe = ti_sci_probe,
3485-
.remove = ti_sci_remove,
34863434
.driver = {
34873435
.name = "ti-sci",
34883436
.of_match_table = of_match_ptr(ti_sci_of_match),
3437+
.suppress_bind_attrs = true,
34893438
},
34903439
};
34913440
module_platform_driver(ti_sci_driver);

drivers/soc/ti/k3-ringacc.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,19 +1551,18 @@ static int k3_ringacc_probe(struct platform_device *pdev)
15511551
return 0;
15521552
}
15531553

1554-
static int k3_ringacc_remove(struct platform_device *pdev)
1554+
static void k3_ringacc_remove(struct platform_device *pdev)
15551555
{
15561556
struct k3_ringacc *ringacc = dev_get_drvdata(&pdev->dev);
15571557

15581558
mutex_lock(&k3_ringacc_list_lock);
15591559
list_del(&ringacc->list);
15601560
mutex_unlock(&k3_ringacc_list_lock);
1561-
return 0;
15621561
}
15631562

15641563
static struct platform_driver k3_ringacc_driver = {
15651564
.probe = k3_ringacc_probe,
1566-
.remove = k3_ringacc_remove,
1565+
.remove_new = k3_ringacc_remove,
15671566
.driver = {
15681567
.name = "k3-ringacc",
15691568
.of_match_table = k3_ringacc_of_match,

drivers/soc/ti/k3-socinfo.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* 31-28 VARIANT Device variant
2121
* 27-12 PARTNO Part number
2222
* 11-1 MFG Indicates TI as manufacturer (0x17)
23-
* 1 Always 1
23+
* 0 Always 1
2424
*/
2525
#define CTRLMMR_WKUP_JTAGID_VARIANT_SHIFT (28)
2626
#define CTRLMMR_WKUP_JTAGID_VARIANT_MASK GENMASK(31, 28)
@@ -60,7 +60,7 @@ k3_chipinfo_partno_to_names(unsigned int partno,
6060
return 0;
6161
}
6262

63-
return -EINVAL;
63+
return -ENODEV;
6464
}
6565

6666
static int k3_chipinfo_probe(struct platform_device *pdev)
@@ -111,8 +111,7 @@ static int k3_chipinfo_probe(struct platform_device *pdev)
111111

112112
ret = k3_chipinfo_partno_to_names(partno_id, soc_dev_attr);
113113
if (ret) {
114-
dev_err(dev, "Unknown SoC JTAGID[0x%08X]\n", jtag_id);
115-
ret = -ENODEV;
114+
dev_err(dev, "Unknown SoC JTAGID[0x%08X]: %d\n", jtag_id, ret);
116115
goto err_free_rev;
117116
}
118117

drivers/soc/ti/knav_dma.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ static int knav_dma_probe(struct platform_device *pdev)
773773
return ret;
774774
}
775775

776-
static int knav_dma_remove(struct platform_device *pdev)
776+
static void knav_dma_remove(struct platform_device *pdev)
777777
{
778778
struct knav_dma_device *dma;
779779

@@ -784,8 +784,6 @@ static int knav_dma_remove(struct platform_device *pdev)
784784

785785
pm_runtime_put_sync(&pdev->dev);
786786
pm_runtime_disable(&pdev->dev);
787-
788-
return 0;
789787
}
790788

791789
static struct of_device_id of_match[] = {
@@ -797,7 +795,7 @@ MODULE_DEVICE_TABLE(of, of_match);
797795

798796
static struct platform_driver knav_dma_driver = {
799797
.probe = knav_dma_probe,
800-
.remove = knav_dma_remove,
798+
.remove_new = knav_dma_remove,
801799
.driver = {
802800
.name = "keystone-navigator-dma",
803801
.of_match_table = of_match,

drivers/soc/ti/knav_qmss_queue.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@
1414
#include <linux/interrupt.h>
1515
#include <linux/io.h>
1616
#include <linux/module.h>
17+
#include <linux/of.h>
1718
#include <linux/of_address.h>
18-
#include <linux/of_device.h>
1919
#include <linux/of_irq.h>
20+
#include <linux/platform_device.h>
2021
#include <linux/pm_runtime.h>
22+
#include <linux/property.h>
2123
#include <linux/slab.h>
2224
#include <linux/soc/ti/knav_qmss.h>
2325

@@ -1754,7 +1756,6 @@ static int knav_queue_probe(struct platform_device *pdev)
17541756
{
17551757
struct device_node *node = pdev->dev.of_node;
17561758
struct device_node *qmgrs, *queue_pools, *regions, *pdsps;
1757-
const struct of_device_id *match;
17581759
struct device *dev = &pdev->dev;
17591760
u32 temp[2];
17601761
int ret;
@@ -1770,8 +1771,7 @@ static int knav_queue_probe(struct platform_device *pdev)
17701771
return -ENOMEM;
17711772
}
17721773

1773-
match = of_match_device(of_match_ptr(keystone_qmss_of_match), dev);
1774-
if (match && match->data)
1774+
if (device_get_match_data(dev))
17751775
kdev->version = QMSS_66AK2G;
17761776

17771777
platform_set_drvdata(pdev, kdev);
@@ -1884,17 +1884,16 @@ static int knav_queue_probe(struct platform_device *pdev)
18841884
return ret;
18851885
}
18861886

1887-
static int knav_queue_remove(struct platform_device *pdev)
1887+
static void knav_queue_remove(struct platform_device *pdev)
18881888
{
18891889
/* TODO: Free resources */
18901890
pm_runtime_put_sync(&pdev->dev);
18911891
pm_runtime_disable(&pdev->dev);
1892-
return 0;
18931892
}
18941893

18951894
static struct platform_driver keystone_qmss_driver = {
18961895
.probe = knav_queue_probe,
1897-
.remove = knav_queue_remove,
1896+
.remove_new = knav_queue_remove,
18981897
.driver = {
18991898
.name = "keystone-navigator-qmss",
19001899
.of_match_table = keystone_qmss_of_match,

drivers/soc/ti/pm33xx.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ static int am33xx_pm_probe(struct platform_device *pdev)
583583
return ret;
584584
}
585585

586-
static int am33xx_pm_remove(struct platform_device *pdev)
586+
static void am33xx_pm_remove(struct platform_device *pdev)
587587
{
588588
pm_runtime_put_sync(&pdev->dev);
589589
pm_runtime_disable(&pdev->dev);
@@ -594,15 +594,14 @@ static int am33xx_pm_remove(struct platform_device *pdev)
594594
am33xx_pm_free_sram();
595595
iounmap(rtc_base_virt);
596596
clk_put(rtc_fck);
597-
return 0;
598597
}
599598

600599
static struct platform_driver am33xx_pm_driver = {
601600
.driver = {
602601
.name = "pm33xx",
603602
},
604603
.probe = am33xx_pm_probe,
605-
.remove = am33xx_pm_remove,
604+
.remove_new = am33xx_pm_remove,
606605
};
607606
module_platform_driver(am33xx_pm_driver);
608607

drivers/soc/ti/pruss.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -565,16 +565,14 @@ static int pruss_probe(struct platform_device *pdev)
565565
return ret;
566566
}
567567

568-
static int pruss_remove(struct platform_device *pdev)
568+
static void pruss_remove(struct platform_device *pdev)
569569
{
570570
struct device *dev = &pdev->dev;
571571

572572
devm_of_platform_depopulate(dev);
573573

574574
pm_runtime_put_sync(dev);
575575
pm_runtime_disable(dev);
576-
577-
return 0;
578576
}
579577

580578
/* instance-specific driver private data */
@@ -610,7 +608,7 @@ static struct platform_driver pruss_driver = {
610608
.of_match_table = pruss_of_match,
611609
},
612610
.probe = pruss_probe,
613-
.remove = pruss_remove,
611+
.remove_new = pruss_remove,
614612
};
615613
module_platform_driver(pruss_driver);
616614

drivers/soc/ti/smartreflex.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@ static int omap_sr_probe(struct platform_device *pdev)
933933
return ret;
934934
}
935935

936-
static int omap_sr_remove(struct platform_device *pdev)
936+
static void omap_sr_remove(struct platform_device *pdev)
937937
{
938938
struct device *dev = &pdev->dev;
939939
struct omap_sr *sr_info = platform_get_drvdata(pdev);
@@ -945,7 +945,6 @@ static int omap_sr_remove(struct platform_device *pdev)
945945
pm_runtime_disable(dev);
946946
clk_unprepare(sr_info->fck);
947947
list_del(&sr_info->node);
948-
return 0;
949948
}
950949

951950
static void omap_sr_shutdown(struct platform_device *pdev)
@@ -970,7 +969,7 @@ MODULE_DEVICE_TABLE(of, omap_sr_match);
970969

971970
static struct platform_driver smartreflex_driver = {
972971
.probe = omap_sr_probe,
973-
.remove = omap_sr_remove,
972+
.remove_new = omap_sr_remove,
974973
.shutdown = omap_sr_shutdown,
975974
.driver = {
976975
.name = DRIVER_NAME,

drivers/soc/ti/wkup_m3_ipc.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev)
713713
return ret;
714714
}
715715

716-
static int wkup_m3_ipc_remove(struct platform_device *pdev)
716+
static void wkup_m3_ipc_remove(struct platform_device *pdev)
717717
{
718718
wkup_m3_ipc_dbg_destroy(m3_ipc_state);
719719

@@ -723,8 +723,6 @@ static int wkup_m3_ipc_remove(struct platform_device *pdev)
723723
rproc_put(m3_ipc_state->rproc);
724724

725725
m3_ipc_state = NULL;
726-
727-
return 0;
728726
}
729727

730728
static int __maybe_unused wkup_m3_ipc_suspend(struct device *dev)
@@ -760,7 +758,7 @@ MODULE_DEVICE_TABLE(of, wkup_m3_ipc_of_match);
760758

761759
static struct platform_driver wkup_m3_ipc_driver = {
762760
.probe = wkup_m3_ipc_probe,
763-
.remove = wkup_m3_ipc_remove,
761+
.remove_new = wkup_m3_ipc_remove,
764762
.driver = {
765763
.name = "wkup_m3_ipc",
766764
.of_match_table = wkup_m3_ipc_of_match,

0 commit comments

Comments
 (0)