aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/ds.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pcmcia/ds.c')
-rw-r--r--drivers/pcmcia/ds.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index f018d26f1817..cabddd49f6ff 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -847,9 +847,29 @@ pcmcia_device_stringattr(prod_id2, prod_id[1]);
847pcmcia_device_stringattr(prod_id3, prod_id[2]); 847pcmcia_device_stringattr(prod_id3, prod_id[2]);
848pcmcia_device_stringattr(prod_id4, prod_id[3]); 848pcmcia_device_stringattr(prod_id4, prod_id[3]);
849 849
850static ssize_t modalias_show(struct device *dev, char *buf)
851{
852 struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
853 int i;
854 u32 hash[4] = { 0, 0, 0, 0};
855
856 /* calculate hashes */
857 for (i=0; i<4; i++) {
858 if (!p_dev->prod_id[i])
859 continue;
860 hash[i] = crc32(0,p_dev->prod_id[i],strlen(p_dev->prod_id[i]));
861 }
862 return sprintf(buf, "pcmcia:m%04Xc%04Xf%02Xfn%02Xpfn%02X"
863 "pa%08Xpb%08Xpc%08Xpd%08X\n",
864 p_dev->has_manf_id ? p_dev->manf_id : 0,
865 p_dev->has_card_id ? p_dev->card_id : 0,
866 p_dev->has_func_id ? p_dev->func_id : 0,
867 p_dev->func, p_dev->device_no,
868 hash[0], hash[1], hash[2], hash[3]);
869}
850 870
851static ssize_t pcmcia_store_allow_func_id_match (struct device * dev, struct device_attribute *attr, 871static ssize_t pcmcia_store_allow_func_id_match(struct device *dev,
852 const char * buf, size_t count) 872 struct device_attribute *attr, const char *buf, size_t count)
853{ 873{
854 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 874 struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
855 if (!count) 875 if (!count)
@@ -873,6 +893,7 @@ static struct device_attribute pcmcia_dev_attrs[] = {
873 __ATTR_RO(prod_id2), 893 __ATTR_RO(prod_id2),
874 __ATTR_RO(prod_id3), 894 __ATTR_RO(prod_id3),
875 __ATTR_RO(prod_id4), 895 __ATTR_RO(prod_id4),
896 __ATTR_RO(modalias),
876 __ATTR(allow_func_id_match, 0200, NULL, pcmcia_store_allow_func_id_match), 897 __ATTR(allow_func_id_match, 0200, NULL, pcmcia_store_allow_func_id_match),
877 __ATTR_NULL, 898 __ATTR_NULL,
878}; 899};