Commit a5b55778 authored by Dominik Brodowski's avatar Dominik Brodowski Committed by Linus Torvalds

[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: default avatarDominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: default avatarBrice Goglin <Brice.Goglin@ens-lyon.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent f602ff7e
...@@ -869,6 +869,23 @@ pcmcia_device_stringattr(prod_id2, prod_id[1]); ...@@ -869,6 +869,23 @@ pcmcia_device_stringattr(prod_id2, prod_id[1]);
pcmcia_device_stringattr(prod_id3, prod_id[2]); pcmcia_device_stringattr(prod_id3, prod_id[2]);
pcmcia_device_stringattr(prod_id4, prod_id[3]); pcmcia_device_stringattr(prod_id4, prod_id[3]);
static ssize_t pcmcia_store_allow_func_id_match (struct device * dev, struct device_attribute *attr,
const char * buf, size_t count)
{
struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
if (!count)
return -EINVAL;
down(&p_dev->socket->skt_sem);
p_dev->allow_func_id_match = 1;
up(&p_dev->socket->skt_sem);
bus_rescan_devices(&pcmcia_bus_type);
return count;
}
static struct device_attribute pcmcia_dev_attrs[] = { static struct device_attribute pcmcia_dev_attrs[] = {
__ATTR(function, 0444, func_show, NULL), __ATTR(function, 0444, func_show, NULL),
__ATTR_RO(func_id), __ATTR_RO(func_id),
...@@ -878,6 +895,7 @@ static struct device_attribute pcmcia_dev_attrs[] = { ...@@ -878,6 +895,7 @@ static struct device_attribute pcmcia_dev_attrs[] = {
__ATTR_RO(prod_id2), __ATTR_RO(prod_id2),
__ATTR_RO(prod_id3), __ATTR_RO(prod_id3),
__ATTR_RO(prod_id4), __ATTR_RO(prod_id4),
__ATTR(allow_func_id_match, 0200, NULL, pcmcia_store_allow_func_id_match),
__ATTR_NULL, __ATTR_NULL,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment