Commit 3df7e8a7 authored by Jeremy Sowden's avatar Jeremy Sowden Committed by Greg Kroah-Hartman

staging: kpc2000: removed superfluous NULL checks from device attribute call-backs.

All the attribute show call-backs check whether pcard is NULL.  However,
pci_set_drvdata(pdev, pcard) is called before the sysfs files are
created during probe, and pci_set_drvdata(pdev, NULL) is not called
until after they are destroyed during remove; therefore, pcard will not
be NULL, and we can drop the checks.
Signed-off-by: default avatarJeremy Sowden <jeremy@azazel.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e416dad1
...@@ -37,9 +37,6 @@ static ssize_t ssid_show(struct device *dev, struct device_attribute *attr, ...@@ -37,9 +37,6 @@ static ssize_t ssid_show(struct device *dev, struct device_attribute *attr,
{ {
struct kp2000_device *pcard = dev_get_drvdata(dev); struct kp2000_device *pcard = dev_get_drvdata(dev);
if (!pcard)
return -ENXIO;
return sprintf(buf, "%016llx\n", pcard->ssid); return sprintf(buf, "%016llx\n", pcard->ssid);
} }
static DEVICE_ATTR_RO(ssid); static DEVICE_ATTR_RO(ssid);
...@@ -49,9 +46,6 @@ static ssize_t ddna_show(struct device *dev, struct device_attribute *attr, ...@@ -49,9 +46,6 @@ static ssize_t ddna_show(struct device *dev, struct device_attribute *attr,
{ {
struct kp2000_device *pcard = dev_get_drvdata(dev); struct kp2000_device *pcard = dev_get_drvdata(dev);
if (!pcard)
return -ENXIO;
return sprintf(buf, "%016llx\n", pcard->ddna); return sprintf(buf, "%016llx\n", pcard->ddna);
} }
static DEVICE_ATTR_RO(ddna); static DEVICE_ATTR_RO(ddna);
...@@ -61,9 +55,6 @@ static ssize_t card_id_show(struct device *dev, struct device_attribute *attr, ...@@ -61,9 +55,6 @@ static ssize_t card_id_show(struct device *dev, struct device_attribute *attr,
{ {
struct kp2000_device *pcard = dev_get_drvdata(dev); struct kp2000_device *pcard = dev_get_drvdata(dev);
if (!pcard)
return -ENXIO;
return sprintf(buf, "%08x\n", pcard->card_id); return sprintf(buf, "%08x\n", pcard->card_id);
} }
static DEVICE_ATTR_RO(card_id); static DEVICE_ATTR_RO(card_id);
...@@ -73,9 +64,6 @@ static ssize_t hw_rev_show(struct device *dev, struct device_attribute *attr, ...@@ -73,9 +64,6 @@ static ssize_t hw_rev_show(struct device *dev, struct device_attribute *attr,
{ {
struct kp2000_device *pcard = dev_get_drvdata(dev); struct kp2000_device *pcard = dev_get_drvdata(dev);
if (!pcard)
return -ENXIO;
return sprintf(buf, "%08x\n", pcard->hardware_revision); return sprintf(buf, "%08x\n", pcard->hardware_revision);
} }
static DEVICE_ATTR_RO(hw_rev); static DEVICE_ATTR_RO(hw_rev);
...@@ -85,9 +73,6 @@ static ssize_t build_show(struct device *dev, struct device_attribute *attr, ...@@ -85,9 +73,6 @@ static ssize_t build_show(struct device *dev, struct device_attribute *attr,
{ {
struct kp2000_device *pcard = dev_get_drvdata(dev); struct kp2000_device *pcard = dev_get_drvdata(dev);
if (!pcard)
return -ENXIO;
return sprintf(buf, "%08x\n", pcard->build_version); return sprintf(buf, "%08x\n", pcard->build_version);
} }
static DEVICE_ATTR_RO(build); static DEVICE_ATTR_RO(build);
...@@ -97,9 +82,6 @@ static ssize_t build_date_show(struct device *dev, ...@@ -97,9 +82,6 @@ static ssize_t build_date_show(struct device *dev,
{ {
struct kp2000_device *pcard = dev_get_drvdata(dev); struct kp2000_device *pcard = dev_get_drvdata(dev);
if (!pcard)
return -ENXIO;
return sprintf(buf, "%08x\n", pcard->build_datestamp); return sprintf(buf, "%08x\n", pcard->build_datestamp);
} }
static DEVICE_ATTR_RO(build_date); static DEVICE_ATTR_RO(build_date);
...@@ -109,9 +91,6 @@ static ssize_t build_time_show(struct device *dev, ...@@ -109,9 +91,6 @@ static ssize_t build_time_show(struct device *dev,
{ {
struct kp2000_device *pcard = dev_get_drvdata(dev); struct kp2000_device *pcard = dev_get_drvdata(dev);
if (!pcard)
return -ENXIO;
return sprintf(buf, "%08x\n", pcard->build_timestamp); return sprintf(buf, "%08x\n", pcard->build_timestamp);
} }
static DEVICE_ATTR_RO(build_time); static DEVICE_ATTR_RO(build_time);
...@@ -122,9 +101,6 @@ static ssize_t cpld_reg_show(struct device *dev, struct device_attribute *attr, ...@@ -122,9 +101,6 @@ static ssize_t cpld_reg_show(struct device *dev, struct device_attribute *attr,
struct kp2000_device *pcard = dev_get_drvdata(dev); struct kp2000_device *pcard = dev_get_drvdata(dev);
u64 val; u64 val;
if (!pcard)
return -ENXIO;
val = readq(pcard->sysinfo_regs_base + REG_CPLD_CONFIG); val = readq(pcard->sysinfo_regs_base + REG_CPLD_CONFIG);
return sprintf(buf, "%016llx\n", val); return sprintf(buf, "%016llx\n", val);
} }
...@@ -138,9 +114,6 @@ static ssize_t cpld_reconfigure(struct device *dev, ...@@ -138,9 +114,6 @@ static ssize_t cpld_reconfigure(struct device *dev,
long wr_val; long wr_val;
int rv; int rv;
if (!pcard)
return -ENXIO;
rv = kstrtol(buf, 0, &wr_val); rv = kstrtol(buf, 0, &wr_val);
if (rv < 0) if (rv < 0)
return rv; return rv;
......
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