diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2005-06-27 19:28:10 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-27 21:03:07 -0400 |
commit | a5b5577898d9330a78dea1c9e75da1540c36bf72 (patch) | |
tree | 8f0b51b7267e765582fc53a4c95e5d7c70b06b35 /drivers/pcmcia/ds.c | |
parent | f602ff7eb4e44e7245bfeeba4d078144703fcd76 (diff) |
[PATCH] pcmcia: allow function-ID based match
The "func_id"-based matching is very fuzzy and can lead to false positives.
Therefore, it should be tried to avoid relying on these matches. Until
most/all existing func_id-based matches are replaced by
manf_id/card_id/prod_id matches (a patch which will ask to send the
appropriate card information to the PCMCIA mailing list will be added once
other, more pressing issues are adressed), we need to emulate cardmgr
behaviour by allowing func_id matches if no manf_id/card_id/prod_id match
occurs. This can only be done in userspace because of modules possibly loaded
with long delays. So, add a per-device sysfs file for this purpose.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Brice Goglin <Brice.Goglin@ens-lyon.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/pcmcia/ds.c')
-rw-r--r-- | drivers/pcmcia/ds.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 66680699e913..19b7dacdbe7a 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -656,7 +656,7 @@ static inline void pcmcia_add_pseudo_device(struct pcmcia_bus_socket *s) | |||
656 | static void pcmcia_bus_rescan(void) | 656 | static void pcmcia_bus_rescan(void) |
657 | { | 657 | { |
658 | /* must be called with skt_sem held */ | 658 | /* must be called with skt_sem held */ |
659 | bus_rescan_devices(&pcmcia_bus_type); | 659 | bus_rescan_devices(&pcmcia_bus_type); |
660 | } | 660 | } |
661 | 661 | ||
662 | static inline int pcmcia_devmatch(struct pcmcia_device *dev, | 662 | static inline int pcmcia_devmatch(struct pcmcia_device *dev, |
@@ -869,6 +869,23 @@ pcmcia_device_stringattr(prod_id2, prod_id[1]); | |||
869 | pcmcia_device_stringattr(prod_id3, prod_id[2]); | 869 | pcmcia_device_stringattr(prod_id3, prod_id[2]); |
870 | pcmcia_device_stringattr(prod_id4, prod_id[3]); | 870 | pcmcia_device_stringattr(prod_id4, prod_id[3]); |
871 | 871 | ||
872 | |||
873 | static ssize_t pcmcia_store_allow_func_id_match (struct device * dev, struct device_attribute *attr, | ||
874 | const char * buf, size_t count) | ||
875 | { | ||
876 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); | ||
877 | if (!count) | ||
878 | return -EINVAL; | ||
879 | |||
880 | down(&p_dev->socket->skt_sem); | ||
881 | p_dev->allow_func_id_match = 1; | ||
882 | up(&p_dev->socket->skt_sem); | ||
883 | |||
884 | bus_rescan_devices(&pcmcia_bus_type); | ||
885 | |||
886 | return count; | ||
887 | } | ||
888 | |||
872 | static struct device_attribute pcmcia_dev_attrs[] = { | 889 | static struct device_attribute pcmcia_dev_attrs[] = { |
873 | __ATTR(function, 0444, func_show, NULL), | 890 | __ATTR(function, 0444, func_show, NULL), |
874 | __ATTR_RO(func_id), | 891 | __ATTR_RO(func_id), |
@@ -878,6 +895,7 @@ static struct device_attribute pcmcia_dev_attrs[] = { | |||
878 | __ATTR_RO(prod_id2), | 895 | __ATTR_RO(prod_id2), |
879 | __ATTR_RO(prod_id3), | 896 | __ATTR_RO(prod_id3), |
880 | __ATTR_RO(prod_id4), | 897 | __ATTR_RO(prod_id4), |
898 | __ATTR(allow_func_id_match, 0200, NULL, pcmcia_store_allow_func_id_match), | ||
881 | __ATTR_NULL, | 899 | __ATTR_NULL, |
882 | }; | 900 | }; |
883 | 901 | ||