@@ -163,6 +163,29 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev)
163
163
}
164
164
uioinfo -> name = pdev -> dev .of_node -> name ;
165
165
uioinfo -> version = "devicetree" ;
166
+ /* alloc pdata */
167
+ pdata = kzalloc (sizeof (pdata ), GFP_KERNEL );
168
+ if (!pdata ) {
169
+ ret = - ENOMEM ;
170
+ dev_err (& pdev -> dev , "unable to kmalloc\n" );
171
+ goto bad2 ;
172
+ }
173
+ pdata -> num_dynamic_regions = 0 ;
174
+ of_property_read_u32 (pdev -> dev .of_node ,
175
+ "uio,number-of-dynamic-regions" ,
176
+ & pdata -> num_dynamic_regions );
177
+ pdata -> dynamic_region_sizes =
178
+ kzalloc (sizeof (* pdata -> dynamic_region_sizes ) *
179
+ pdata -> num_dynamic_regions , GFP_KERNEL );
180
+ if (!pdata -> dynamic_region_sizes ) {
181
+ ret = - ENOMEM ;
182
+ dev_err (& pdev -> dev , "unable to kmalloc\n" );
183
+ goto bad2 ;
184
+ }
185
+ of_property_read_u32_array (pdev -> dev .of_node ,
186
+ "uio,dynamic-regions-sizes" ,
187
+ pdata -> dynamic_region_sizes ,
188
+ pdata -> num_dynamic_regions );
166
189
}
167
190
168
191
if (!uioinfo || !uioinfo -> name || !uioinfo -> version ) {
@@ -327,10 +350,13 @@ static const struct dev_pm_ops uio_dmem_genirq_dev_pm_ops = {
327
350
};
328
351
329
352
#ifdef CONFIG_OF
330
- static const struct of_device_id uio_of_genirq_match [] = {
331
- { /* empty for now */ },
353
+ static struct of_device_id uio_of_genirq_match [] = {
354
+ { .compatible = "dmem-uio" , },
355
+ { /* end of list */ },
332
356
};
333
357
MODULE_DEVICE_TABLE (of , uio_of_genirq_match );
358
+ module_param_string (of_id , uio_of_genirq_match [0 ].compatible , 128 , 0 );
359
+ MODULE_PARM_DESC (of_id , "Openfirmware id of the device to be handled by uio" );
334
360
#endif
335
361
336
362
static struct platform_driver uio_dmem_genirq = {
0 commit comments