@@ -317,47 +317,49 @@ static acpi_status tci_raw(struct toshiba_acpi_dev *dev,
317317 * may be useful (such as "not supported").
318318 */
319319
320- static acpi_status hci_write1 (struct toshiba_acpi_dev * dev , u32 reg ,
321- u32 in1 , u32 * result )
320+ static u32 hci_write1 (struct toshiba_acpi_dev * dev , u32 reg , u32 in1 )
322321{
323322 u32 in [TCI_WORDS ] = { HCI_SET , reg , in1 , 0 , 0 , 0 };
324323 u32 out [TCI_WORDS ];
325324 acpi_status status = tci_raw (dev , in , out );
326- * result = ( status == AE_OK ) ? out [ 0 ] : TOS_FAILURE ;
327- return status ;
325+
326+ return ACPI_SUCCESS ( status ) ? out [ 0 ] : TOS_FAILURE ;
328327}
329328
330- static acpi_status hci_read1 (struct toshiba_acpi_dev * dev , u32 reg ,
331- u32 * out1 , u32 * result )
329+ static u32 hci_read1 (struct toshiba_acpi_dev * dev , u32 reg , u32 * out1 )
332330{
333331 u32 in [TCI_WORDS ] = { HCI_GET , reg , 0 , 0 , 0 , 0 };
334332 u32 out [TCI_WORDS ];
335333 acpi_status status = tci_raw (dev , in , out );
334+ if (ACPI_FAILURE (status ))
335+ return TOS_FAILURE ;
336+
336337 * out1 = out [2 ];
337- * result = ( status == AE_OK ) ? out [ 0 ] : TOS_FAILURE ;
338- return status ;
338+
339+ return out [ 0 ] ;
339340}
340341
341- static acpi_status hci_write2 (struct toshiba_acpi_dev * dev , u32 reg ,
342- u32 in1 , u32 in2 , u32 * result )
342+ static u32 hci_write2 (struct toshiba_acpi_dev * dev , u32 reg , u32 in1 , u32 in2 )
343343{
344344 u32 in [TCI_WORDS ] = { HCI_SET , reg , in1 , in2 , 0 , 0 };
345345 u32 out [TCI_WORDS ];
346346 acpi_status status = tci_raw (dev , in , out );
347- * result = ( status == AE_OK ) ? out [ 0 ] : TOS_FAILURE ;
348- return status ;
347+
348+ return ACPI_SUCCESS ( status ) ? out [ 0 ] : TOS_FAILURE ;
349349}
350350
351- static acpi_status hci_read2 (struct toshiba_acpi_dev * dev , u32 reg ,
352- u32 * out1 , u32 * out2 , u32 * result )
351+ static u32 hci_read2 (struct toshiba_acpi_dev * dev , u32 reg , u32 * out1 , u32 * out2 )
353352{
354353 u32 in [TCI_WORDS ] = { HCI_GET , reg , * out1 , * out2 , 0 , 0 };
355354 u32 out [TCI_WORDS ];
356355 acpi_status status = tci_raw (dev , in , out );
356+ if (ACPI_FAILURE (status ))
357+ return TOS_FAILURE ;
358+
357359 * out1 = out [2 ];
358360 * out2 = out [3 ];
359- * result = ( status == AE_OK ) ? out [ 0 ] : TOS_FAILURE ;
360- return status ;
361+
362+ return out [ 0 ] ;
361363}
362364
363365/* common sci tasks
@@ -407,25 +409,26 @@ static void sci_close(struct toshiba_acpi_dev *dev)
407409 pr_info ("Toshiba SCI is not present\n" );
408410}
409411
410- static acpi_status sci_read (struct toshiba_acpi_dev * dev , u32 reg ,
411- u32 * out1 , u32 * result )
412+ static u32 sci_read (struct toshiba_acpi_dev * dev , u32 reg , u32 * out1 )
412413{
413414 u32 in [TCI_WORDS ] = { SCI_GET , reg , 0 , 0 , 0 , 0 };
414415 u32 out [TCI_WORDS ];
415416 acpi_status status = tci_raw (dev , in , out );
417+ if (ACPI_FAILURE (status ))
418+ return TOS_FAILURE ;
419+
416420 * out1 = out [2 ];
417- * result = ( ACPI_SUCCESS ( status )) ? out [ 0 ] : TOS_FAILURE ;
418- return status ;
421+
422+ return out [ 0 ] ;
419423}
420424
421- static acpi_status sci_write (struct toshiba_acpi_dev * dev , u32 reg ,
422- u32 in1 , u32 * result )
425+ static u32 sci_write (struct toshiba_acpi_dev * dev , u32 reg , u32 in1 )
423426{
424427 u32 in [TCI_WORDS ] = { SCI_SET , reg , in1 , 0 , 0 , 0 };
425428 u32 out [TCI_WORDS ];
426429 acpi_status status = tci_raw (dev , in , out );
427- * result = ( ACPI_SUCCESS ( status )) ? out [ 0 ] : TOS_FAILURE ;
428- return status ;
430+
431+ return ACPI_SUCCESS ( status ) ? out [ 0 ] : TOS_FAILURE ;
429432}
430433
431434/* Illumination support */
@@ -457,17 +460,16 @@ static void toshiba_illumination_set(struct led_classdev *cdev,
457460 struct toshiba_acpi_dev * dev = container_of (cdev ,
458461 struct toshiba_acpi_dev , led_dev );
459462 u32 state , result ;
460- acpi_status status ;
461463
462464 /* First request : initialize communication. */
463465 if (!sci_open (dev ))
464466 return ;
465467
466468 /* Switch the illumination on/off */
467469 state = brightness ? 1 : 0 ;
468- status = sci_write (dev , SCI_ILLUMINATION , state , & result );
470+ result = sci_write (dev , SCI_ILLUMINATION , state );
469471 sci_close (dev );
470- if (ACPI_FAILURE ( status ) ) {
472+ if (result == TOS_FAILURE ) {
471473 pr_err ("ACPI call for illumination failed\n" );
472474 return ;
473475 } else if (result == TOS_NOT_SUPPORTED ) {
@@ -481,16 +483,15 @@ static enum led_brightness toshiba_illumination_get(struct led_classdev *cdev)
481483 struct toshiba_acpi_dev * dev = container_of (cdev ,
482484 struct toshiba_acpi_dev , led_dev );
483485 u32 state , result ;
484- acpi_status status ;
485486
486487 /* First request : initialize communication. */
487488 if (!sci_open (dev ))
488489 return LED_OFF ;
489490
490491 /* Check the illumination */
491- status = sci_read (dev , SCI_ILLUMINATION , & state , & result );
492+ result = sci_read (dev , SCI_ILLUMINATION , & state );
492493 sci_close (dev );
493- if (ACPI_FAILURE ( status ) || result == TOS_INPUT_DATA_ERROR ) {
494+ if (result == TOS_FAILURE || result == TOS_INPUT_DATA_ERROR ) {
494495 pr_err ("ACPI call for illumination failed\n" );
495496 return LED_OFF ;
496497 } else if (result == TOS_NOT_SUPPORTED ) {
@@ -541,14 +542,13 @@ static int toshiba_kbd_illum_available(struct toshiba_acpi_dev *dev)
541542static int toshiba_kbd_illum_status_set (struct toshiba_acpi_dev * dev , u32 time )
542543{
543544 u32 result ;
544- acpi_status status ;
545545
546546 if (!sci_open (dev ))
547547 return - EIO ;
548548
549- status = sci_write (dev , SCI_KBD_ILLUM_STATUS , time , & result );
549+ result = sci_write (dev , SCI_KBD_ILLUM_STATUS , time );
550550 sci_close (dev );
551- if (ACPI_FAILURE ( status ) || result == TOS_INPUT_DATA_ERROR ) {
551+ if (result == TOS_FAILURE || result == TOS_INPUT_DATA_ERROR ) {
552552 pr_err ("ACPI call to set KBD backlight status failed\n" );
553553 return - EIO ;
554554 } else if (result == TOS_NOT_SUPPORTED ) {
@@ -562,14 +562,13 @@ static int toshiba_kbd_illum_status_set(struct toshiba_acpi_dev *dev, u32 time)
562562static int toshiba_kbd_illum_status_get (struct toshiba_acpi_dev * dev , u32 * time )
563563{
564564 u32 result ;
565- acpi_status status ;
566565
567566 if (!sci_open (dev ))
568567 return - EIO ;
569568
570- status = sci_read (dev , SCI_KBD_ILLUM_STATUS , time , & result );
569+ result = sci_read (dev , SCI_KBD_ILLUM_STATUS , time );
571570 sci_close (dev );
572- if (ACPI_FAILURE ( status ) || result == TOS_INPUT_DATA_ERROR ) {
571+ if (result == TOS_FAILURE || result == TOS_INPUT_DATA_ERROR ) {
573572 pr_err ("ACPI call to get KBD backlight status failed\n" );
574573 return - EIO ;
575574 } else if (result == TOS_NOT_SUPPORTED ) {
@@ -585,11 +584,10 @@ static enum led_brightness toshiba_kbd_backlight_get(struct led_classdev *cdev)
585584 struct toshiba_acpi_dev * dev = container_of (cdev ,
586585 struct toshiba_acpi_dev , kbd_led );
587586 u32 state , result ;
588- acpi_status status ;
589587
590588 /* Check the keyboard backlight state */
591- status = hci_read1 (dev , HCI_KBD_ILLUMINATION , & state , & result );
592- if (ACPI_FAILURE ( status ) || result == TOS_INPUT_DATA_ERROR ) {
589+ result = hci_read1 (dev , HCI_KBD_ILLUMINATION , & state );
590+ if (result == TOS_FAILURE || result == TOS_INPUT_DATA_ERROR ) {
593591 pr_err ("ACPI call to get the keyboard backlight failed\n" );
594592 return LED_OFF ;
595593 } else if (result == TOS_NOT_SUPPORTED ) {
@@ -606,12 +604,11 @@ static void toshiba_kbd_backlight_set(struct led_classdev *cdev,
606604 struct toshiba_acpi_dev * dev = container_of (cdev ,
607605 struct toshiba_acpi_dev , kbd_led );
608606 u32 state , result ;
609- acpi_status status ;
610607
611608 /* Set the keyboard backlight state */
612609 state = brightness ? 1 : 0 ;
613- status = hci_write1 (dev , HCI_KBD_ILLUMINATION , state , & result );
614- if (ACPI_FAILURE ( status ) || result == TOS_INPUT_DATA_ERROR ) {
610+ result = hci_write1 (dev , HCI_KBD_ILLUMINATION , state );
611+ if (result == TOS_FAILURE || result == TOS_INPUT_DATA_ERROR ) {
615612 pr_err ("ACPI call to set KBD Illumination mode failed\n" );
616613 return ;
617614 } else if (result == TOS_NOT_SUPPORTED ) {
@@ -624,14 +621,13 @@ static void toshiba_kbd_backlight_set(struct led_classdev *cdev,
624621static int toshiba_touchpad_set (struct toshiba_acpi_dev * dev , u32 state )
625622{
626623 u32 result ;
627- acpi_status status ;
628624
629625 if (!sci_open (dev ))
630626 return - EIO ;
631627
632- status = sci_write (dev , SCI_TOUCHPAD , state , & result );
628+ result = sci_write (dev , SCI_TOUCHPAD , state );
633629 sci_close (dev );
634- if (ACPI_FAILURE ( status ) ) {
630+ if (result == TOS_FAILURE ) {
635631 pr_err ("ACPI call to set the touchpad failed\n" );
636632 return - EIO ;
637633 } else if (result == TOS_NOT_SUPPORTED ) {
@@ -644,14 +640,13 @@ static int toshiba_touchpad_set(struct toshiba_acpi_dev *dev, u32 state)
644640static int toshiba_touchpad_get (struct toshiba_acpi_dev * dev , u32 * state )
645641{
646642 u32 result ;
647- acpi_status status ;
648643
649644 if (!sci_open (dev ))
650645 return - EIO ;
651646
652- status = sci_read (dev , SCI_TOUCHPAD , state , & result );
647+ result = sci_read (dev , SCI_TOUCHPAD , state );
653648 sci_close (dev );
654- if (ACPI_FAILURE ( status ) ) {
649+ if (result == TOS_FAILURE ) {
655650 pr_err ("ACPI call to query the touchpad failed\n" );
656651 return - EIO ;
657652 } else if (result == TOS_NOT_SUPPORTED ) {
@@ -767,7 +762,7 @@ static u32 hci_get_bt_present(struct toshiba_acpi_dev *dev, bool *present)
767762
768763 value = 0 ;
769764 value2 = 0 ;
770- hci_read2 (dev , HCI_WIRELESS , & value , & value2 , & hci_result );
765+ hci_result = hci_read2 (dev , HCI_WIRELESS , & value , & value2 );
771766 if (hci_result == TOS_SUCCESS )
772767 * present = (value & HCI_WIRELESS_BT_PRESENT ) ? true : false;
773768
@@ -781,7 +776,7 @@ static u32 hci_get_radio_state(struct toshiba_acpi_dev *dev, bool *radio_state)
781776
782777 value = 0 ;
783778 value2 = 0x0001 ;
784- hci_read2 (dev , HCI_WIRELESS , & value , & value2 , & hci_result );
779+ hci_result = hci_read2 (dev , HCI_WIRELESS , & value , & value2 );
785780
786781 * radio_state = value & HCI_WIRELESS_KILL_SWITCH ;
787782 return hci_result ;
@@ -808,8 +803,8 @@ static int bt_rfkill_set_block(void *data, bool blocked)
808803 goto out ;
809804 }
810805
811- hci_write2 (dev , HCI_WIRELESS , value , HCI_WIRELESS_BT_POWER , & result1 );
812- hci_write2 (dev , HCI_WIRELESS , value , HCI_WIRELESS_BT_ATTACH , & result2 );
806+ result1 = hci_write2 (dev , HCI_WIRELESS , value , HCI_WIRELESS_BT_POWER );
807+ result2 = hci_write2 (dev , HCI_WIRELESS , value , HCI_WIRELESS_BT_ATTACH );
813808
814809 if (result1 != TOS_SUCCESS || result2 != TOS_SUCCESS )
815810 err = - EIO ;
@@ -854,7 +849,7 @@ static int get_tr_backlight_status(struct toshiba_acpi_dev *dev, bool *enabled)
854849 u32 hci_result ;
855850 u32 status ;
856851
857- hci_read1 (dev , HCI_TR_BACKLIGHT , & status , & hci_result );
852+ hci_result = hci_read1 (dev , HCI_TR_BACKLIGHT , & status );
858853 * enabled = !status ;
859854 return hci_result == TOS_SUCCESS ? 0 : - EIO ;
860855}
@@ -864,7 +859,7 @@ static int set_tr_backlight_status(struct toshiba_acpi_dev *dev, bool enable)
864859 u32 hci_result ;
865860 u32 value = !enable ;
866861
867- hci_write1 (dev , HCI_TR_BACKLIGHT , value , & hci_result );
862+ hci_result = hci_write1 (dev , HCI_TR_BACKLIGHT , value );
868863 return hci_result == TOS_SUCCESS ? 0 : - EIO ;
869864}
870865
@@ -886,7 +881,7 @@ static int __get_lcd_brightness(struct toshiba_acpi_dev *dev)
886881 brightness ++ ;
887882 }
888883
889- hci_read1 (dev , HCI_LCD_BRIGHTNESS , & value , & hci_result );
884+ hci_result = hci_read1 (dev , HCI_LCD_BRIGHTNESS , & value );
890885 if (hci_result == TOS_SUCCESS )
891886 return brightness + (value >> HCI_LCD_BRIGHTNESS_SHIFT );
892887
@@ -1001,7 +996,7 @@ static int get_video_status(struct toshiba_acpi_dev *dev, u32 *status)
1001996{
1002997 u32 hci_result ;
1003998
1004- hci_read1 (dev , HCI_VIDEO_OUT , status , & hci_result );
999+ hci_result = hci_read1 (dev , HCI_VIDEO_OUT , status );
10051000 return hci_result == TOS_SUCCESS ? 0 : - EIO ;
10061001}
10071002
@@ -1105,7 +1100,7 @@ static int get_fan_status(struct toshiba_acpi_dev *dev, u32 *status)
11051100{
11061101 u32 hci_result ;
11071102
1108- hci_read1 (dev , HCI_FAN , status , & hci_result );
1103+ hci_result = hci_read1 (dev , HCI_FAN , status );
11091104 return hci_result == TOS_SUCCESS ? 0 : - EIO ;
11101105}
11111106
@@ -1145,7 +1140,7 @@ static ssize_t fan_proc_write(struct file *file, const char __user *buf,
11451140
11461141 if (sscanf (cmd , " force_on : %i" , & value ) == 1 &&
11471142 value >= 0 && value <= 1 ) {
1148- hci_write1 (dev , HCI_FAN , value , & hci_result );
1143+ hci_result = hci_write1 (dev , HCI_FAN , value );
11491144 if (hci_result != TOS_SUCCESS )
11501145 return - EIO ;
11511146 else
@@ -1173,7 +1168,7 @@ static int keys_proc_show(struct seq_file *m, void *v)
11731168 u32 value ;
11741169
11751170 if (!dev -> key_event_valid && dev -> system_event_supported ) {
1176- hci_read1 (dev , HCI_SYSTEM_EVENT , & value , & hci_result );
1171+ hci_result = hci_read1 (dev , HCI_SYSTEM_EVENT , & value );
11771172 if (hci_result == TOS_SUCCESS ) {
11781173 dev -> key_event_valid = 1 ;
11791174 dev -> last_key_event = value ;
@@ -1183,7 +1178,7 @@ static int keys_proc_show(struct seq_file *m, void *v)
11831178 /* This is a workaround for an unresolved issue on
11841179 * some machines where system events sporadically
11851180 * become disabled. */
1186- hci_write1 (dev , HCI_SYSTEM_EVENT , 1 , & hci_result );
1181+ hci_result = hci_write1 (dev , HCI_SYSTEM_EVENT , 1 );
11871182 pr_notice ("Re-enabled hotkeys\n" );
11881183 } else {
11891184 pr_err ("Error reading hotkey status\n" );
@@ -1677,7 +1672,7 @@ static int toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev)
16771672 if (acpi_has_method (dev -> acpi_dev -> handle , "INFO" ))
16781673 dev -> info_supported = 1 ;
16791674 else {
1680- hci_write1 (dev , HCI_SYSTEM_EVENT , 1 , & hci_result );
1675+ hci_result = hci_write1 (dev , HCI_SYSTEM_EVENT , 1 );
16811676 if (hci_result == TOS_SUCCESS )
16821677 dev -> system_event_supported = 1 ;
16831678 }
@@ -1700,7 +1695,7 @@ static int toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev)
17001695 goto err_remove_filter ;
17011696 }
17021697
1703- hci_write1 (dev , HCI_HOTKEY_EVENT , HCI_HOTKEY_ENABLE , & hci_result );
1698+ hci_result = hci_write1 (dev , HCI_HOTKEY_EVENT , HCI_HOTKEY_ENABLE );
17041699 return 0 ;
17051700
17061701 err_remove_filter :
@@ -1961,7 +1956,7 @@ static void toshiba_acpi_notify(struct acpi_device *acpi_dev, u32 event)
19611956 toshiba_acpi_report_hotkey (dev , scancode );
19621957 } else if (dev -> system_event_supported ) {
19631958 do {
1964- hci_read1 (dev , HCI_SYSTEM_EVENT , & value , & hci_result );
1959+ hci_result = hci_read1 (dev , HCI_SYSTEM_EVENT , & value );
19651960 switch (hci_result ) {
19661961 case TOS_SUCCESS :
19671962 toshiba_acpi_report_hotkey (dev , (int )value );
@@ -1972,8 +1967,8 @@ static void toshiba_acpi_notify(struct acpi_device *acpi_dev, u32 event)
19721967 * issue on some machines where system events
19731968 * sporadically become disabled.
19741969 */
1975- hci_write1 ( dev , HCI_SYSTEM_EVENT , 1 ,
1976- & hci_result );
1970+ hci_result =
1971+ hci_write1 ( dev , HCI_SYSTEM_EVENT , 1 );
19771972 pr_notice ("Re-enabled hotkeys\n" );
19781973 /* fall through */
19791974 default :
@@ -1991,7 +1986,7 @@ static int toshiba_acpi_suspend(struct device *device)
19911986 u32 result ;
19921987
19931988 if (dev -> hotkey_dev )
1994- hci_write1 (dev , HCI_HOTKEY_EVENT , HCI_HOTKEY_DISABLE , & result );
1989+ result = hci_write1 (dev , HCI_HOTKEY_EVENT , HCI_HOTKEY_DISABLE );
19951990
19961991 return 0 ;
19971992}
@@ -2008,7 +2003,7 @@ static int toshiba_acpi_resume(struct device *device)
20082003 if (ACPI_FAILURE (status ))
20092004 pr_info ("Unable to re-enable hotkeys\n" );
20102005
2011- hci_write1 (dev , HCI_HOTKEY_EVENT , HCI_HOTKEY_ENABLE , & result );
2006+ result = hci_write1 (dev , HCI_HOTKEY_EVENT , HCI_HOTKEY_ENABLE );
20122007 }
20132008
20142009 return 0 ;
0 commit comments