@@ -301,37 +301,37 @@ static struct attribute_group ideapad_attribute_group = {
301
301
.attrs = ideapad_attributes
302
302
};
303
303
304
- static int __devinit ideapad_platform_init (void )
304
+ static int __devinit ideapad_platform_init (struct ideapad_private * priv )
305
305
{
306
306
int result ;
307
307
308
- ideapad_priv -> platform_device = platform_device_alloc ("ideapad" , -1 );
309
- if (!ideapad_priv -> platform_device )
308
+ priv -> platform_device = platform_device_alloc ("ideapad" , -1 );
309
+ if (!priv -> platform_device )
310
310
return - ENOMEM ;
311
- platform_set_drvdata (ideapad_priv -> platform_device , ideapad_priv );
311
+ platform_set_drvdata (priv -> platform_device , priv );
312
312
313
- result = platform_device_add (ideapad_priv -> platform_device );
313
+ result = platform_device_add (priv -> platform_device );
314
314
if (result )
315
315
goto fail_platform_device ;
316
316
317
- result = sysfs_create_group (& ideapad_priv -> platform_device -> dev .kobj ,
317
+ result = sysfs_create_group (& priv -> platform_device -> dev .kobj ,
318
318
& ideapad_attribute_group );
319
319
if (result )
320
320
goto fail_sysfs ;
321
321
return 0 ;
322
322
323
323
fail_sysfs :
324
- platform_device_del (ideapad_priv -> platform_device );
324
+ platform_device_del (priv -> platform_device );
325
325
fail_platform_device :
326
- platform_device_put (ideapad_priv -> platform_device );
326
+ platform_device_put (priv -> platform_device );
327
327
return result ;
328
328
}
329
329
330
- static void ideapad_platform_exit (void )
330
+ static void ideapad_platform_exit (struct ideapad_private * priv )
331
331
{
332
- sysfs_remove_group (& ideapad_priv -> platform_device -> dev .kobj ,
332
+ sysfs_remove_group (& priv -> platform_device -> dev .kobj ,
333
333
& ideapad_attribute_group );
334
- platform_device_unregister (ideapad_priv -> platform_device );
334
+ platform_device_unregister (priv -> platform_device );
335
335
}
336
336
337
337
/*
@@ -343,7 +343,7 @@ static const struct key_entry ideapad_keymap[] = {
343
343
{ KE_END , 0 },
344
344
};
345
345
346
- static int __devinit ideapad_input_init (void )
346
+ static int __devinit ideapad_input_init (struct ideapad_private * priv )
347
347
{
348
348
struct input_dev * inputdev ;
349
349
int error ;
@@ -357,7 +357,7 @@ static int __devinit ideapad_input_init(void)
357
357
inputdev -> name = "Ideapad extra buttons" ;
358
358
inputdev -> phys = "ideapad/input0" ;
359
359
inputdev -> id .bustype = BUS_HOST ;
360
- inputdev -> dev .parent = & ideapad_priv -> platform_device -> dev ;
360
+ inputdev -> dev .parent = & priv -> platform_device -> dev ;
361
361
362
362
error = sparse_keymap_setup (inputdev , ideapad_keymap , NULL );
363
363
if (error ) {
@@ -371,7 +371,7 @@ static int __devinit ideapad_input_init(void)
371
371
goto err_free_keymap ;
372
372
}
373
373
374
- ideapad_priv -> inputdev = inputdev ;
374
+ priv -> inputdev = inputdev ;
375
375
return 0 ;
376
376
377
377
err_free_keymap :
@@ -381,16 +381,17 @@ static int __devinit ideapad_input_init(void)
381
381
return error ;
382
382
}
383
383
384
- static void __devexit ideapad_input_exit (void )
384
+ static void __devexit ideapad_input_exit (struct ideapad_private * priv )
385
385
{
386
- sparse_keymap_free (ideapad_priv -> inputdev );
387
- input_unregister_device (ideapad_priv -> inputdev );
388
- ideapad_priv -> inputdev = NULL ;
386
+ sparse_keymap_free (priv -> inputdev );
387
+ input_unregister_device (priv -> inputdev );
388
+ priv -> inputdev = NULL ;
389
389
}
390
390
391
- static void ideapad_input_report (unsigned long scancode )
391
+ static void ideapad_input_report (struct ideapad_private * priv ,
392
+ unsigned long scancode )
392
393
{
393
- sparse_keymap_report_event (ideapad_priv -> inputdev , scancode , 1 , true);
394
+ sparse_keymap_report_event (priv -> inputdev , scancode , 1 , true);
394
395
}
395
396
396
397
/*
@@ -417,11 +418,11 @@ static int __devinit ideapad_acpi_add(struct acpi_device *adevice)
417
418
priv -> handle = adevice -> handle ;
418
419
dev_set_drvdata (& adevice -> dev , priv );
419
420
420
- ret = ideapad_platform_init ();
421
+ ret = ideapad_platform_init (priv );
421
422
if (ret )
422
423
goto platform_failed ;
423
424
424
- ret = ideapad_input_init ();
425
+ ret = ideapad_input_init (priv );
425
426
if (ret )
426
427
goto input_failed ;
427
428
@@ -434,7 +435,7 @@ static int __devinit ideapad_acpi_add(struct acpi_device *adevice)
434
435
return 0 ;
435
436
436
437
input_failed :
437
- ideapad_platform_exit ();
438
+ ideapad_platform_exit (priv );
438
439
platform_failed :
439
440
kfree (priv );
440
441
return ret ;
@@ -447,8 +448,8 @@ static int __devexit ideapad_acpi_remove(struct acpi_device *adevice, int type)
447
448
448
449
for (i = IDEAPAD_DEV_WLAN ; i < IDEAPAD_DEV_KILLSW ; i ++ )
449
450
ideapad_unregister_rfkill (adevice , i );
450
- ideapad_input_exit ();
451
- ideapad_platform_exit ();
451
+ ideapad_input_exit (priv );
452
+ ideapad_platform_exit (priv );
452
453
dev_set_drvdata (& adevice -> dev , NULL );
453
454
kfree (priv );
454
455
@@ -457,6 +458,7 @@ static int __devexit ideapad_acpi_remove(struct acpi_device *adevice, int type)
457
458
458
459
static void ideapad_acpi_notify (struct acpi_device * adevice , u32 event )
459
460
{
461
+ struct ideapad_private * priv = dev_get_drvdata (& adevice -> dev );
460
462
acpi_handle handle = adevice -> handle ;
461
463
unsigned long vpc1 , vpc2 , vpc_bit ;
462
464
@@ -471,7 +473,7 @@ static void ideapad_acpi_notify(struct acpi_device *adevice, u32 event)
471
473
if (vpc_bit == 9 )
472
474
ideapad_sync_rfk_state (adevice );
473
475
else
474
- ideapad_input_report (vpc_bit );
476
+ ideapad_input_report (priv , vpc_bit );
475
477
}
476
478
}
477
479
}
0 commit comments