Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6:
Staging: ti-st: remove st_get_plat_device

+24 -10
-1
drivers/staging/ti-st/st.h
··· 80 extern long st_register(struct st_proto_s *); 81 extern long st_unregister(enum proto_type); 82 83 - extern struct platform_device *st_get_plat_device(void); 84 #endif /* ST_H */
··· 80 extern long st_register(struct st_proto_s *); 81 extern long st_unregister(enum proto_type); 82 83 #endif /* ST_H */
+4 -5
drivers/staging/ti-st/st_core.c
··· 38 #include "st_ll.h" 39 #include "st.h" 40 41 - #define VERBOSE 42 /* strings to be used for rfkill entries and by 43 * ST Core to be used for sysfs debug entry 44 */ ··· 580 long err = 0; 581 unsigned long flags = 0; 582 583 - st_kim_ref(&st_gdata); 584 pr_info("%s(%d) ", __func__, new_proto->type); 585 if (st_gdata == NULL || new_proto == NULL || new_proto->recv == NULL 586 || new_proto->reg_complete_cb == NULL) { ··· 712 713 pr_debug("%s: %d ", __func__, type); 714 715 - st_kim_ref(&st_gdata); 716 if (type < ST_BT || type >= ST_MAX) { 717 pr_err(" protocol %d not supported", type); 718 return -EPROTONOSUPPORT; ··· 766 #endif 767 long len; 768 769 - st_kim_ref(&st_gdata); 770 if (unlikely(skb == NULL || st_gdata == NULL 771 || st_gdata->tty == NULL)) { 772 pr_err("data/tty unavailable to perform write"); ··· 817 struct st_data_s *st_gdata; 818 pr_info("%s ", __func__); 819 820 - st_kim_ref(&st_gdata); 821 st_gdata->tty = tty; 822 tty->disc_data = st_gdata; 823
··· 38 #include "st_ll.h" 39 #include "st.h" 40 41 /* strings to be used for rfkill entries and by 42 * ST Core to be used for sysfs debug entry 43 */ ··· 581 long err = 0; 582 unsigned long flags = 0; 583 584 + st_kim_ref(&st_gdata, 0); 585 pr_info("%s(%d) ", __func__, new_proto->type); 586 if (st_gdata == NULL || new_proto == NULL || new_proto->recv == NULL 587 || new_proto->reg_complete_cb == NULL) { ··· 713 714 pr_debug("%s: %d ", __func__, type); 715 716 + st_kim_ref(&st_gdata, 0); 717 if (type < ST_BT || type >= ST_MAX) { 718 pr_err(" protocol %d not supported", type); 719 return -EPROTONOSUPPORT; ··· 767 #endif 768 long len; 769 770 + st_kim_ref(&st_gdata, 0); 771 if (unlikely(skb == NULL || st_gdata == NULL 772 || st_gdata->tty == NULL)) { 773 pr_err("data/tty unavailable to perform write"); ··· 818 struct st_data_s *st_gdata; 819 pr_info("%s ", __func__); 820 821 + st_kim_ref(&st_gdata, 0); 822 st_gdata->tty = tty; 823 tty->disc_data = st_gdata; 824
+1 -1
drivers/staging/ti-st/st_core.h
··· 117 void st_core_exit(struct st_data_s *); 118 119 /* ask for reference from KIM */ 120 - void st_kim_ref(struct st_data_s **); 121 122 #define GPS_STUB_TEST 123 #ifdef GPS_STUB_TEST
··· 117 void st_core_exit(struct st_data_s *); 118 119 /* ask for reference from KIM */ 120 + void st_kim_ref(struct st_data_s **, int); 121 122 #define GPS_STUB_TEST 123 #ifdef GPS_STUB_TEST
+19 -3
drivers/staging/ti-st/st_kim.c
··· 72 PROTO_ENTRY(ST_GPS, "GPS"), 73 }; 74 75 76 /**********************************************************************/ 77 /* internal functions */ 78 79 /** 80 * validate_firmware_response - ··· 368 struct kim_data_s *kim_gdata; 369 pr_info(" %s ", __func__); 370 371 - kim_pdev = st_get_plat_device(); 372 kim_gdata = dev_get_drvdata(&kim_pdev->dev); 373 374 if (kim_gdata->gpios[type] == -1) { ··· 589 * This would enable multiple such platform devices to exist 590 * on a given platform 591 */ 592 - void st_kim_ref(struct st_data_s **core_data) 593 { 594 struct platform_device *pdev; 595 struct kim_data_s *kim_gdata; 596 /* get kim_gdata reference from platform device */ 597 - pdev = st_get_plat_device(); 598 kim_gdata = dev_get_drvdata(&pdev->dev); 599 *core_data = kim_gdata->core_data; 600 } ··· 638 long *gpios = pdev->dev.platform_data; 639 struct kim_data_s *kim_gdata; 640 641 kim_gdata = kzalloc(sizeof(struct kim_data_s), GFP_ATOMIC); 642 if (!kim_gdata) { 643 pr_err("no mem to allocate");
··· 72 PROTO_ENTRY(ST_GPS, "GPS"), 73 }; 74 75 + #define MAX_ST_DEVICES 3 /* Imagine 1 on each UART for now */ 76 + struct platform_device *st_kim_devices[MAX_ST_DEVICES]; 77 78 /**********************************************************************/ 79 /* internal functions */ 80 + 81 + /** 82 + * st_get_plat_device - 83 + * function which returns the reference to the platform device 84 + * requested by id. As of now only 1 such device exists (id=0) 85 + * the context requesting for reference can get the id to be 86 + * requested by a. The protocol driver which is registering or 87 + * b. the tty device which is opened. 88 + */ 89 + static struct platform_device *st_get_plat_device(int id) 90 + { 91 + return st_kim_devices[id]; 92 + } 93 94 /** 95 * validate_firmware_response - ··· 353 struct kim_data_s *kim_gdata; 354 pr_info(" %s ", __func__); 355 356 + kim_pdev = st_get_plat_device(0); 357 kim_gdata = dev_get_drvdata(&kim_pdev->dev); 358 359 if (kim_gdata->gpios[type] == -1) { ··· 574 * This would enable multiple such platform devices to exist 575 * on a given platform 576 */ 577 + void st_kim_ref(struct st_data_s **core_data, int id) 578 { 579 struct platform_device *pdev; 580 struct kim_data_s *kim_gdata; 581 /* get kim_gdata reference from platform device */ 582 + pdev = st_get_plat_device(id); 583 kim_gdata = dev_get_drvdata(&pdev->dev); 584 *core_data = kim_gdata->core_data; 585 } ··· 623 long *gpios = pdev->dev.platform_data; 624 struct kim_data_s *kim_gdata; 625 626 + st_kim_devices[pdev->id] = pdev; 627 kim_gdata = kzalloc(sizeof(struct kim_data_s), GFP_ATOMIC); 628 if (!kim_gdata) { 629 pr_err("no mem to allocate");