Skip to content

Commit fba395e

Browse files
author
Dominik Brodowski
committed
[PATCH] pcmcia: remove dev_link_t and client_handle_t indirection
dev_link_t * and client_handle_t both mean struct pcmcai_device * by now. Therefore, remove all such indirections. Signed-off-by: Dominik Brodowski <[email protected]>
1 parent fd23823 commit fba395e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1235
-1467
lines changed

drivers/bluetooth/bluecard_cs.c

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ typedef struct bluecard_info_t {
8585
} bluecard_info_t;
8686

8787

88-
static void bluecard_config(dev_link_t *link);
89-
static void bluecard_release(dev_link_t *link);
88+
static void bluecard_config(struct pcmcia_device *link);
89+
static void bluecard_release(struct pcmcia_device *link);
9090

9191
static void bluecard_detach(struct pcmcia_device *p_dev);
9292

@@ -856,17 +856,16 @@ static int bluecard_close(bluecard_info_t *info)
856856
return 0;
857857
}
858858

859-
static int bluecard_attach(struct pcmcia_device *p_dev)
859+
static int bluecard_attach(struct pcmcia_device *link)
860860
{
861861
bluecard_info_t *info;
862-
dev_link_t *link = dev_to_instance(p_dev);
863862

864863
/* Create new info device */
865864
info = kzalloc(sizeof(*info), GFP_KERNEL);
866865
if (!info)
867866
return -ENOMEM;
868867

869-
info->p_dev = p_dev;
868+
info->p_dev = link;
870869
link->priv = info;
871870

872871
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
@@ -887,9 +886,8 @@ static int bluecard_attach(struct pcmcia_device *p_dev)
887886
}
888887

889888

890-
static void bluecard_detach(struct pcmcia_device *p_dev)
889+
static void bluecard_detach(struct pcmcia_device *link)
891890
{
892-
dev_link_t *link = dev_to_instance(p_dev);
893891
bluecard_info_t *info = link->priv;
894892

895893
if (link->state & DEV_CONFIG)
@@ -899,7 +897,7 @@ static void bluecard_detach(struct pcmcia_device *p_dev)
899897
}
900898

901899

902-
static int first_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse)
900+
static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse)
903901
{
904902
int i;
905903

@@ -914,9 +912,8 @@ static int first_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse
914912
return pcmcia_parse_tuple(handle, tuple, parse);
915913
}
916914

917-
static void bluecard_config(dev_link_t *link)
915+
static void bluecard_config(struct pcmcia_device *link)
918916
{
919-
client_handle_t handle = link->handle;
920917
bluecard_info_t *info = link->priv;
921918
tuple_t tuple;
922919
u_short buf[256];
@@ -930,7 +927,7 @@ static void bluecard_config(dev_link_t *link)
930927

931928
/* Get configuration register information */
932929
tuple.DesiredTuple = CISTPL_CONFIG;
933-
last_ret = first_tuple(handle, &tuple, &parse);
930+
last_ret = first_tuple(link, &tuple, &parse);
934931
if (last_ret != CS_SUCCESS) {
935932
last_fn = ParseTuple;
936933
goto cs_failed;
@@ -947,25 +944,25 @@ static void bluecard_config(dev_link_t *link)
947944

948945
for (n = 0; n < 0x400; n += 0x40) {
949946
link->io.BasePort1 = n ^ 0x300;
950-
i = pcmcia_request_io(link->handle, &link->io);
947+
i = pcmcia_request_io(link, &link->io);
951948
if (i == CS_SUCCESS)
952949
break;
953950
}
954951

955952
if (i != CS_SUCCESS) {
956-
cs_error(link->handle, RequestIO, i);
953+
cs_error(link, RequestIO, i);
957954
goto failed;
958955
}
959956

960-
i = pcmcia_request_irq(link->handle, &link->irq);
957+
i = pcmcia_request_irq(link, &link->irq);
961958
if (i != CS_SUCCESS) {
962-
cs_error(link->handle, RequestIRQ, i);
959+
cs_error(link, RequestIRQ, i);
963960
link->irq.AssignedIRQ = 0;
964961
}
965962

966-
i = pcmcia_request_configuration(link->handle, &link->conf);
963+
i = pcmcia_request_configuration(link, &link->conf);
967964
if (i != CS_SUCCESS) {
968-
cs_error(link->handle, RequestConfiguration, i);
965+
cs_error(link, RequestConfiguration, i);
969966
goto failed;
970967
}
971968

@@ -979,14 +976,14 @@ static void bluecard_config(dev_link_t *link)
979976
return;
980977

981978
cs_failed:
982-
cs_error(link->handle, last_fn, last_ret);
979+
cs_error(link, last_fn, last_ret);
983980

984981
failed:
985982
bluecard_release(link);
986983
}
987984

988985

989-
static void bluecard_release(dev_link_t *link)
986+
static void bluecard_release(struct pcmcia_device *link)
990987
{
991988
bluecard_info_t *info = link->priv;
992989

@@ -995,7 +992,7 @@ static void bluecard_release(dev_link_t *link)
995992

996993
del_timer(&(info->timer));
997994

998-
pcmcia_disable_device(link->handle);
995+
pcmcia_disable_device(link);
999996
}
1000997

1001998
static struct pcmcia_device_id bluecard_ids[] = {

drivers/bluetooth/bt3c_cs.c

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ typedef struct bt3c_info_t {
8888
} bt3c_info_t;
8989

9090

91-
static void bt3c_config(dev_link_t *link);
92-
static void bt3c_release(dev_link_t *link);
91+
static void bt3c_config(struct pcmcia_device *link);
92+
static void bt3c_release(struct pcmcia_device *link);
9393

9494
static void bt3c_detach(struct pcmcia_device *p_dev);
9595

@@ -645,17 +645,16 @@ static int bt3c_close(bt3c_info_t *info)
645645
return 0;
646646
}
647647

648-
static int bt3c_attach(struct pcmcia_device *p_dev)
648+
static int bt3c_attach(struct pcmcia_device *link)
649649
{
650650
bt3c_info_t *info;
651-
dev_link_t *link = dev_to_instance(p_dev);
652651

653652
/* Create new info device */
654653
info = kzalloc(sizeof(*info), GFP_KERNEL);
655654
if (!info)
656655
return -ENOMEM;
657656

658-
info->p_dev = p_dev;
657+
info->p_dev = link;
659658
link->priv = info;
660659

661660
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
@@ -676,9 +675,8 @@ static int bt3c_attach(struct pcmcia_device *p_dev)
676675
}
677676

678677

679-
static void bt3c_detach(struct pcmcia_device *p_dev)
678+
static void bt3c_detach(struct pcmcia_device *link)
680679
{
681-
dev_link_t *link = dev_to_instance(p_dev);
682680
bt3c_info_t *info = link->priv;
683681

684682
if (link->state & DEV_CONFIG)
@@ -687,7 +685,7 @@ static void bt3c_detach(struct pcmcia_device *p_dev)
687685
kfree(info);
688686
}
689687

690-
static int get_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse)
688+
static int get_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse)
691689
{
692690
int i;
693691

@@ -698,24 +696,23 @@ static int get_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse)
698696
return pcmcia_parse_tuple(handle, tuple, parse);
699697
}
700698

701-
static int first_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse)
699+
static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse)
702700
{
703701
if (pcmcia_get_first_tuple(handle, tuple) != CS_SUCCESS)
704702
return CS_NO_MORE_ITEMS;
705703
return get_tuple(handle, tuple, parse);
706704
}
707705

708-
static int next_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse)
706+
static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse)
709707
{
710708
if (pcmcia_get_next_tuple(handle, tuple) != CS_SUCCESS)
711709
return CS_NO_MORE_ITEMS;
712710
return get_tuple(handle, tuple, parse);
713711
}
714712

715-
static void bt3c_config(dev_link_t *link)
713+
static void bt3c_config(struct pcmcia_device *link)
716714
{
717715
static kio_addr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
718-
client_handle_t handle = link->handle;
719716
bt3c_info_t *info = link->priv;
720717
tuple_t tuple;
721718
u_short buf[256];
@@ -730,7 +727,7 @@ static void bt3c_config(dev_link_t *link)
730727

731728
/* Get configuration register information */
732729
tuple.DesiredTuple = CISTPL_CONFIG;
733-
last_ret = first_tuple(handle, &tuple, &parse);
730+
last_ret = first_tuple(link, &tuple, &parse);
734731
if (last_ret != CS_SUCCESS) {
735732
last_fn = ParseTuple;
736733
goto cs_failed;
@@ -749,7 +746,7 @@ static void bt3c_config(dev_link_t *link)
749746
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
750747
/* Two tries: without IO aliases, then with aliases */
751748
for (try = 0; try < 2; try++) {
752-
i = first_tuple(handle, &tuple, &parse);
749+
i = first_tuple(link, &tuple, &parse);
753750
while (i != CS_NO_MORE_ITEMS) {
754751
if (i != CS_SUCCESS)
755752
goto next_entry;
@@ -759,49 +756,49 @@ static void bt3c_config(dev_link_t *link)
759756
link->conf.ConfigIndex = cf->index;
760757
link->io.BasePort1 = cf->io.win[0].base;
761758
link->io.IOAddrLines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK;
762-
i = pcmcia_request_io(link->handle, &link->io);
759+
i = pcmcia_request_io(link, &link->io);
763760
if (i == CS_SUCCESS)
764761
goto found_port;
765762
}
766763
next_entry:
767-
i = next_tuple(handle, &tuple, &parse);
764+
i = next_tuple(link, &tuple, &parse);
768765
}
769766
}
770767

771768
/* Second pass: try to find an entry that isn't picky about
772769
its base address, then try to grab any standard serial port
773770
address, and finally try to get any free port. */
774-
i = first_tuple(handle, &tuple, &parse);
771+
i = first_tuple(link, &tuple, &parse);
775772
while (i != CS_NO_MORE_ITEMS) {
776773
if ((i == CS_SUCCESS) && (cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) {
777774
link->conf.ConfigIndex = cf->index;
778775
for (j = 0; j < 5; j++) {
779776
link->io.BasePort1 = base[j];
780777
link->io.IOAddrLines = base[j] ? 16 : 3;
781-
i = pcmcia_request_io(link->handle, &link->io);
778+
i = pcmcia_request_io(link, &link->io);
782779
if (i == CS_SUCCESS)
783780
goto found_port;
784781
}
785782
}
786-
i = next_tuple(handle, &tuple, &parse);
783+
i = next_tuple(link, &tuple, &parse);
787784
}
788785

789786
found_port:
790787
if (i != CS_SUCCESS) {
791788
BT_ERR("No usable port range found");
792-
cs_error(link->handle, RequestIO, i);
789+
cs_error(link, RequestIO, i);
793790
goto failed;
794791
}
795792

796-
i = pcmcia_request_irq(link->handle, &link->irq);
793+
i = pcmcia_request_irq(link, &link->irq);
797794
if (i != CS_SUCCESS) {
798-
cs_error(link->handle, RequestIRQ, i);
795+
cs_error(link, RequestIRQ, i);
799796
link->irq.AssignedIRQ = 0;
800797
}
801798

802-
i = pcmcia_request_configuration(link->handle, &link->conf);
799+
i = pcmcia_request_configuration(link, &link->conf);
803800
if (i != CS_SUCCESS) {
804-
cs_error(link->handle, RequestConfiguration, i);
801+
cs_error(link, RequestConfiguration, i);
805802
goto failed;
806803
}
807804

@@ -815,21 +812,21 @@ static void bt3c_config(dev_link_t *link)
815812
return;
816813

817814
cs_failed:
818-
cs_error(link->handle, last_fn, last_ret);
815+
cs_error(link, last_fn, last_ret);
819816

820817
failed:
821818
bt3c_release(link);
822819
}
823820

824821

825-
static void bt3c_release(dev_link_t *link)
822+
static void bt3c_release(struct pcmcia_device *link)
826823
{
827824
bt3c_info_t *info = link->priv;
828825

829826
if (link->state & DEV_PRESENT)
830827
bt3c_close(info);
831828

832-
pcmcia_disable_device(link->handle);
829+
pcmcia_disable_device(link);
833830
}
834831

835832

0 commit comments

Comments
 (0)