File tree Expand file tree Collapse file tree 1 file changed +6
-17
lines changed Expand file tree Collapse file tree 1 file changed +6
-17
lines changed Original file line number Diff line number Diff line change @@ -31,34 +31,23 @@ static const struct of_device_id bcm_kona_smc_ids[] __initconst = {
31
31
int __init bcm_kona_smc_init (void )
32
32
{
33
33
struct device_node * node ;
34
- const __be32 * prop_val ;
35
- u64 prop_size = 0 ;
36
- unsigned long buffer_size ;
37
- u32 buffer_phys ;
34
+ struct resource res ;
35
+ int ret ;
38
36
39
37
/* Read buffer addr and size from the device tree node */
40
38
node = of_find_matching_node (NULL , bcm_kona_smc_ids );
41
39
if (!node )
42
40
return - ENODEV ;
43
41
44
- prop_val = of_get_address (node , 0 , & prop_size , NULL );
42
+ ret = of_address_to_resource (node , 0 , & res );
45
43
of_node_put (node );
46
- if (! prop_val )
44
+ if (ret )
47
45
return - EINVAL ;
48
46
49
- /* We assume space for four 32-bit arguments */
50
- if (prop_size < 4 * sizeof (u32 ) || prop_size > (u64 )ULONG_MAX )
51
- return - EINVAL ;
52
- buffer_size = (unsigned long )prop_size ;
53
-
54
- buffer_phys = be32_to_cpup (prop_val );
55
- if (!buffer_phys )
56
- return - EINVAL ;
57
-
58
- bcm_smc_buffer = ioremap (buffer_phys , buffer_size );
47
+ bcm_smc_buffer = ioremap (res .start , resource_size (& res ));
59
48
if (!bcm_smc_buffer )
60
49
return - ENOMEM ;
61
- bcm_smc_buffer_phys = buffer_phys ;
50
+ bcm_smc_buffer_phys = res . start ;
62
51
63
52
pr_info ("Kona Secure API initialized\n" );
64
53
You can’t perform that action at this time.
0 commit comments