16
16
#include <linux/kernel.h>
17
17
#include <linux/mailbox_client.h>
18
18
#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>
20
23
#include <linux/semaphore.h>
21
24
#include <linux/slab.h>
22
25
#include <linux/soc/ti/ti-msgmgr.h>
@@ -190,19 +193,6 @@ static int ti_sci_debugfs_create(struct platform_device *pdev,
190
193
return 0 ;
191
194
}
192
195
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
- }
206
196
#else /* CONFIG_DEBUG_FS */
207
197
static inline int ti_sci_debugfs_create (struct platform_device * dev ,
208
198
struct ti_sci_info * info )
@@ -485,7 +475,7 @@ static int ti_sci_cmd_get_revision(struct ti_sci_info *info)
485
475
ver -> abi_major = rev_info -> abi_major ;
486
476
ver -> abi_minor = rev_info -> abi_minor ;
487
477
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 ,
489
479
sizeof (ver -> firmware_description ));
490
480
491
481
fail :
@@ -2886,7 +2876,6 @@ static void ti_sci_setup_ops(struct ti_sci_info *info)
2886
2876
const struct ti_sci_handle * ti_sci_get_handle (struct device * dev )
2887
2877
{
2888
2878
struct device_node * ti_sci_np ;
2889
- struct list_head * p ;
2890
2879
struct ti_sci_handle * handle = NULL ;
2891
2880
struct ti_sci_info * info ;
2892
2881
@@ -2901,8 +2890,7 @@ const struct ti_sci_handle *ti_sci_get_handle(struct device *dev)
2901
2890
}
2902
2891
2903
2892
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 ) {
2906
2894
if (ti_sci_np == info -> dev -> of_node ) {
2907
2895
handle = & info -> handle ;
2908
2896
info -> users ++ ;
@@ -3012,7 +3000,6 @@ const struct ti_sci_handle *ti_sci_get_by_phandle(struct device_node *np,
3012
3000
struct ti_sci_handle * handle = NULL ;
3013
3001
struct device_node * ti_sci_np ;
3014
3002
struct ti_sci_info * info ;
3015
- struct list_head * p ;
3016
3003
3017
3004
if (!np ) {
3018
3005
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,
3024
3011
return ERR_PTR (- ENODEV );
3025
3012
3026
3013
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 ) {
3029
3015
if (ti_sci_np == info -> dev -> of_node ) {
3030
3016
handle = & info -> handle ;
3031
3017
info -> users ++ ;
@@ -3310,7 +3296,6 @@ MODULE_DEVICE_TABLE(of, ti_sci_of_match);
3310
3296
static int ti_sci_probe (struct platform_device * pdev )
3311
3297
{
3312
3298
struct device * dev = & pdev -> dev ;
3313
- const struct of_device_id * of_id ;
3314
3299
const struct ti_sci_desc * desc ;
3315
3300
struct ti_sci_xfer * xfer ;
3316
3301
struct ti_sci_info * info = NULL ;
@@ -3321,12 +3306,7 @@ static int ti_sci_probe(struct platform_device *pdev)
3321
3306
int reboot = 0 ;
3322
3307
u32 h_id ;
3323
3308
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 );
3330
3310
3331
3311
info = devm_kzalloc (dev , sizeof (* info ), GFP_KERNEL );
3332
3312
if (!info )
@@ -3449,43 +3429,12 @@ static int ti_sci_probe(struct platform_device *pdev)
3449
3429
return ret ;
3450
3430
}
3451
3431
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
-
3483
3432
static struct platform_driver ti_sci_driver = {
3484
3433
.probe = ti_sci_probe ,
3485
- .remove = ti_sci_remove ,
3486
3434
.driver = {
3487
3435
.name = "ti-sci" ,
3488
3436
.of_match_table = of_match_ptr (ti_sci_of_match ),
3437
+ .suppress_bind_attrs = true,
3489
3438
},
3490
3439
};
3491
3440
module_platform_driver (ti_sci_driver );
0 commit comments