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 */
207197static 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
491481fail :
@@ -2886,7 +2876,6 @@ static void ti_sci_setup_ops(struct ti_sci_info *info)
28862876const 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);
33103296static 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-
34833432static 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};
34913440module_platform_driver (ti_sci_driver );
0 commit comments