Skip to content

Commit 15b99ac

Browse files
author
Dominik Brodowski
committed
[PATCH] pcmcia: add return value to _config() functions
Most of the driver initialization isn't done in the .probe function, but in the internal _config() functions. Make them return a value, so that .probe can properly report whether the probing of the device succeeded or not. Signed-off-by: Dominik Brodowski <[email protected]>
1 parent fba395e commit 15b99ac

Some content is hidden

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

45 files changed

+379
-404
lines changed

drivers/bluetooth/bluecard_cs.c

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

8787

88-
static void bluecard_config(struct pcmcia_device *link);
88+
static int bluecard_config(struct pcmcia_device *link);
8989
static void bluecard_release(struct pcmcia_device *link);
9090

9191
static void bluecard_detach(struct pcmcia_device *p_dev);
@@ -856,7 +856,7 @@ static int bluecard_close(bluecard_info_t *info)
856856
return 0;
857857
}
858858

859-
static int bluecard_attach(struct pcmcia_device *link)
859+
static int bluecard_probe(struct pcmcia_device *link)
860860
{
861861
bluecard_info_t *info;
862862

@@ -880,9 +880,7 @@ static int bluecard_attach(struct pcmcia_device *link)
880880
link->conf.IntType = INT_MEMORY_AND_IO;
881881

882882
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
883-
bluecard_config(link);
884-
885-
return 0;
883+
return bluecard_config(link);
886884
}
887885

888886

@@ -912,7 +910,7 @@ static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t
912910
return pcmcia_parse_tuple(handle, tuple, parse);
913911
}
914912

915-
static void bluecard_config(struct pcmcia_device *link)
913+
static int bluecard_config(struct pcmcia_device *link)
916914
{
917915
bluecard_info_t *info = link->priv;
918916
tuple_t tuple;
@@ -973,13 +971,14 @@ static void bluecard_config(struct pcmcia_device *link)
973971
link->dev_node = &info->node;
974972
link->state &= ~DEV_CONFIG_PENDING;
975973

976-
return;
974+
return 0;
977975

978976
cs_failed:
979977
cs_error(link, last_fn, last_ret);
980978

981979
failed:
982980
bluecard_release(link);
981+
return -ENODEV;
983982
}
984983

985984

@@ -1008,7 +1007,7 @@ static struct pcmcia_driver bluecard_driver = {
10081007
.drv = {
10091008
.name = "bluecard_cs",
10101009
},
1011-
.probe = bluecard_attach,
1010+
.probe = bluecard_probe,
10121011
.remove = bluecard_detach,
10131012
.id_table = bluecard_ids,
10141013
};

drivers/bluetooth/bt3c_cs.c

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

9090

91-
static void bt3c_config(struct pcmcia_device *link);
91+
static int bt3c_config(struct pcmcia_device *link);
9292
static void bt3c_release(struct pcmcia_device *link);
9393

9494
static void bt3c_detach(struct pcmcia_device *p_dev);
@@ -645,7 +645,7 @@ static int bt3c_close(bt3c_info_t *info)
645645
return 0;
646646
}
647647

648-
static int bt3c_attach(struct pcmcia_device *link)
648+
static int bt3c_probe(struct pcmcia_device *link)
649649
{
650650
bt3c_info_t *info;
651651

@@ -669,9 +669,7 @@ static int bt3c_attach(struct pcmcia_device *link)
669669
link->conf.IntType = INT_MEMORY_AND_IO;
670670

671671
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
672-
bt3c_config(link);
673-
674-
return 0;
672+
return bt3c_config(link);
675673
}
676674

677675

@@ -710,7 +708,7 @@ static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *
710708
return get_tuple(handle, tuple, parse);
711709
}
712710

713-
static void bt3c_config(struct pcmcia_device *link)
711+
static int bt3c_config(struct pcmcia_device *link)
714712
{
715713
static kio_addr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
716714
bt3c_info_t *info = link->priv;
@@ -809,13 +807,14 @@ static void bt3c_config(struct pcmcia_device *link)
809807
link->dev_node = &info->node;
810808
link->state &= ~DEV_CONFIG_PENDING;
811809

812-
return;
810+
return 0;
813811

814812
cs_failed:
815813
cs_error(link, last_fn, last_ret);
816814

817815
failed:
818816
bt3c_release(link);
817+
return -ENODEV;
819818
}
820819

821820

@@ -841,7 +840,7 @@ static struct pcmcia_driver bt3c_driver = {
841840
.drv = {
842841
.name = "bt3c_cs",
843842
},
844-
.probe = bt3c_attach,
843+
.probe = bt3c_probe,
845844
.remove = bt3c_detach,
846845
.id_table = bt3c_ids,
847846
};

drivers/bluetooth/btuart_cs.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ typedef struct btuart_info_t {
8484
} btuart_info_t;
8585

8686

87-
static void btuart_config(struct pcmcia_device *link);
87+
static int btuart_config(struct pcmcia_device *link);
8888
static void btuart_release(struct pcmcia_device *link);
8989

9090
static void btuart_detach(struct pcmcia_device *p_dev);
@@ -576,7 +576,7 @@ static int btuart_close(btuart_info_t *info)
576576
return 0;
577577
}
578578

579-
static int btuart_attach(struct pcmcia_device *link)
579+
static int btuart_probe(struct pcmcia_device *link)
580580
{
581581
btuart_info_t *info;
582582

@@ -600,9 +600,7 @@ static int btuart_attach(struct pcmcia_device *link)
600600
link->conf.IntType = INT_MEMORY_AND_IO;
601601

602602
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
603-
btuart_config(link);
604-
605-
return 0;
603+
return btuart_config(link);
606604
}
607605

608606

@@ -641,7 +639,7 @@ static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *
641639
return get_tuple(handle, tuple, parse);
642640
}
643641

644-
static void btuart_config(struct pcmcia_device *link)
642+
static int btuart_config(struct pcmcia_device *link)
645643
{
646644
static kio_addr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
647645
btuart_info_t *info = link->priv;
@@ -741,13 +739,14 @@ static void btuart_config(struct pcmcia_device *link)
741739
link->dev_node = &info->node;
742740
link->state &= ~DEV_CONFIG_PENDING;
743741

744-
return;
742+
return 0;
745743

746744
cs_failed:
747745
cs_error(link, last_fn, last_ret);
748746

749747
failed:
750748
btuart_release(link);
749+
return -ENODEV;
751750
}
752751

753752

@@ -772,7 +771,7 @@ static struct pcmcia_driver btuart_driver = {
772771
.drv = {
773772
.name = "btuart_cs",
774773
},
775-
.probe = btuart_attach,
774+
.probe = btuart_probe,
776775
.remove = btuart_detach,
777776
.id_table = btuart_ids,
778777
};

drivers/bluetooth/dtl1_cs.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ typedef struct dtl1_info_t {
8787
} dtl1_info_t;
8888

8989

90-
static void dtl1_config(struct pcmcia_device *link);
90+
static int dtl1_config(struct pcmcia_device *link);
9191
static void dtl1_release(struct pcmcia_device *link);
9292

9393
static void dtl1_detach(struct pcmcia_device *p_dev);
@@ -555,7 +555,7 @@ static int dtl1_close(dtl1_info_t *info)
555555
return 0;
556556
}
557557

558-
static int dtl1_attach(struct pcmcia_device *link)
558+
static int dtl1_probe(struct pcmcia_device *link)
559559
{
560560
dtl1_info_t *info;
561561

@@ -579,9 +579,7 @@ static int dtl1_attach(struct pcmcia_device *link)
579579
link->conf.IntType = INT_MEMORY_AND_IO;
580580

581581
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
582-
dtl1_config(link);
583-
584-
return 0;
582+
return dtl1_config(link);
585583
}
586584

587585

@@ -620,7 +618,7 @@ static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *
620618
return get_tuple(handle, tuple, parse);
621619
}
622620

623-
static void dtl1_config(struct pcmcia_device *link)
621+
static int dtl1_config(struct pcmcia_device *link)
624622
{
625623
dtl1_info_t *info = link->priv;
626624
tuple_t tuple;
@@ -693,13 +691,14 @@ static void dtl1_config(struct pcmcia_device *link)
693691
link->dev_node = &info->node;
694692
link->state &= ~DEV_CONFIG_PENDING;
695693

696-
return;
694+
return 0;
697695

698696
cs_failed:
699697
cs_error(link, last_fn, last_ret);
700698

701699
failed:
702700
dtl1_release(link);
701+
return -ENODEV;
703702
}
704703

705704

@@ -727,7 +726,7 @@ static struct pcmcia_driver dtl1_driver = {
727726
.drv = {
728727
.name = "dtl1_cs",
729728
},
730-
.probe = dtl1_attach,
729+
.probe = dtl1_probe,
731730
.remove = dtl1_detach,
732731
.id_table = dtl1_ids,
733732
};

drivers/char/pcmcia/cm4000_cs.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1759,7 +1759,7 @@ static void cmm_cm4000_release(struct pcmcia_device * link)
17591759

17601760
/*==== Interface to PCMCIA Layer =======================================*/
17611761

1762-
static void cm4000_config(struct pcmcia_device * link, int devno)
1762+
static int cm4000_config(struct pcmcia_device * link, int devno)
17631763
{
17641764
struct cm4000_dev *dev;
17651765
tuple_t tuple;
@@ -1846,14 +1846,15 @@ static void cm4000_config(struct pcmcia_device * link, int devno)
18461846
link->dev_node = &dev->node;
18471847
link->state &= ~DEV_CONFIG_PENDING;
18481848

1849-
return;
1849+
return 0;
18501850

18511851
cs_failed:
18521852
cs_error(link, fail_fn, fail_rc);
18531853
cs_release:
18541854
cm4000_release(link);
18551855

18561856
link->state &= ~DEV_CONFIG_PENDING;
1857+
return -ENODEV;
18571858
}
18581859

18591860
static int cm4000_suspend(struct pcmcia_device *link)
@@ -1883,10 +1884,10 @@ static void cm4000_release(struct pcmcia_device *link)
18831884
pcmcia_disable_device(link);
18841885
}
18851886

1886-
static int cm4000_attach(struct pcmcia_device *link)
1887+
static int cm4000_probe(struct pcmcia_device *link)
18871888
{
18881889
struct cm4000_dev *dev;
1889-
int i;
1890+
int i, ret;
18901891

18911892
for (i = 0; i < CM4000_MAX_DEV; i++)
18921893
if (dev_table[i] == NULL)
@@ -1913,7 +1914,9 @@ static int cm4000_attach(struct pcmcia_device *link)
19131914
init_waitqueue_head(&dev->readq);
19141915

19151916
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
1916-
cm4000_config(link, i);
1917+
ret = cm4000_config(link, i);
1918+
if (ret)
1919+
return ret;
19171920

19181921
class_device_create(cmm_class, NULL, MKDEV(major, i), NULL,
19191922
"cmm%d", i);
@@ -1968,7 +1971,7 @@ static struct pcmcia_driver cm4000_driver = {
19681971
.drv = {
19691972
.name = "cm4000_cs",
19701973
},
1971-
.probe = cm4000_attach,
1974+
.probe = cm4000_probe,
19721975
.remove = cm4000_detach,
19731976
.suspend = cm4000_suspend,
19741977
.resume = cm4000_resume,

drivers/char/pcmcia/cm4040_cs.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ static void cm4040_reader_release(struct pcmcia_device *link)
514514
return;
515515
}
516516

517-
static void reader_config(struct pcmcia_device *link, int devno)
517+
static int reader_config(struct pcmcia_device *link, int devno)
518518
{
519519
struct reader_dev *dev;
520520
tuple_t tuple;
@@ -610,13 +610,14 @@ static void reader_config(struct pcmcia_device *link, int devno)
610610
link->io.BasePort1, link->io.BasePort1+link->io.NumPorts1);
611611
DEBUGP(2, dev, "<- reader_config (succ)\n");
612612

613-
return;
613+
return 0;
614614

615615
cs_failed:
616616
cs_error(link, fail_fn, fail_rc);
617617
cs_release:
618618
reader_release(link);
619619
link->state &= ~DEV_CONFIG_PENDING;
620+
return -ENODEV;
620621
}
621622

622623
static void reader_release(struct pcmcia_device *link)
@@ -625,10 +626,10 @@ static void reader_release(struct pcmcia_device *link)
625626
pcmcia_disable_device(link);
626627
}
627628

628-
static int reader_attach(struct pcmcia_device *link)
629+
static int reader_probe(struct pcmcia_device *link)
629630
{
630631
struct reader_dev *dev;
631-
int i;
632+
int i, ret;
632633

633634
for (i = 0; i < CM_MAX_DEV; i++) {
634635
if (dev_table[i] == NULL)
@@ -659,7 +660,9 @@ static int reader_attach(struct pcmcia_device *link)
659660
dev->poll_timer.function = &cm4040_do_poll;
660661

661662
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
662-
reader_config(link, i);
663+
ret = reader_config(link, i);
664+
if (ret)
665+
return ret;
663666

664667
class_device_create(cmx_class, NULL, MKDEV(major, i), NULL,
665668
"cmx%d", i);
@@ -715,7 +718,7 @@ static struct pcmcia_driver reader_driver = {
715718
.drv = {
716719
.name = "cm4040_cs",
717720
},
718-
.probe = reader_attach,
721+
.probe = reader_probe,
719722
.remove = reader_detach,
720723
.id_table = cm4040_ids,
721724
};

0 commit comments

Comments
 (0)