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: Jeremy Sowden <jeremy@azazel.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
e416dad158
commit
3df7e8a77e
@ -37,9 +37,6 @@ static ssize_t ssid_show(struct device *dev, struct device_attribute *attr,
|
||||
{
|
||||
struct kp2000_device *pcard = dev_get_drvdata(dev);
|
||||
|
||||
if (!pcard)
|
||||
return -ENXIO;
|
||||
|
||||
return sprintf(buf, "%016llx\n", pcard->ssid);
|
||||
}
|
||||
static DEVICE_ATTR_RO(ssid);
|
||||
@ -49,9 +46,6 @@ static ssize_t ddna_show(struct device *dev, struct device_attribute *attr,
|
||||
{
|
||||
struct kp2000_device *pcard = dev_get_drvdata(dev);
|
||||
|
||||
if (!pcard)
|
||||
return -ENXIO;
|
||||
|
||||
return sprintf(buf, "%016llx\n", pcard->ddna);
|
||||
}
|
||||
static DEVICE_ATTR_RO(ddna);
|
||||
@ -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);
|
||||
|
||||
if (!pcard)
|
||||
return -ENXIO;
|
||||
|
||||
return sprintf(buf, "%08x\n", pcard->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,
|
||||
{
|
||||
struct kp2000_device *pcard = dev_get_drvdata(dev);
|
||||
|
||||
if (!pcard)
|
||||
return -ENXIO;
|
||||
|
||||
return sprintf(buf, "%08x\n", pcard->hardware_revision);
|
||||
}
|
||||
static DEVICE_ATTR_RO(hw_rev);
|
||||
@ -85,9 +73,6 @@ static ssize_t build_show(struct device *dev, struct device_attribute *attr,
|
||||
{
|
||||
struct kp2000_device *pcard = dev_get_drvdata(dev);
|
||||
|
||||
if (!pcard)
|
||||
return -ENXIO;
|
||||
|
||||
return sprintf(buf, "%08x\n", pcard->build_version);
|
||||
}
|
||||
static DEVICE_ATTR_RO(build);
|
||||
@ -97,9 +82,6 @@ static ssize_t build_date_show(struct device *dev,
|
||||
{
|
||||
struct kp2000_device *pcard = dev_get_drvdata(dev);
|
||||
|
||||
if (!pcard)
|
||||
return -ENXIO;
|
||||
|
||||
return sprintf(buf, "%08x\n", pcard->build_datestamp);
|
||||
}
|
||||
static DEVICE_ATTR_RO(build_date);
|
||||
@ -109,9 +91,6 @@ static ssize_t build_time_show(struct device *dev,
|
||||
{
|
||||
struct kp2000_device *pcard = dev_get_drvdata(dev);
|
||||
|
||||
if (!pcard)
|
||||
return -ENXIO;
|
||||
|
||||
return sprintf(buf, "%08x\n", pcard->build_timestamp);
|
||||
}
|
||||
static DEVICE_ATTR_RO(build_time);
|
||||
@ -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);
|
||||
u64 val;
|
||||
|
||||
if (!pcard)
|
||||
return -ENXIO;
|
||||
|
||||
val = readq(pcard->sysinfo_regs_base + REG_CPLD_CONFIG);
|
||||
return sprintf(buf, "%016llx\n", val);
|
||||
}
|
||||
@ -138,9 +114,6 @@ static ssize_t cpld_reconfigure(struct device *dev,
|
||||
long wr_val;
|
||||
int rv;
|
||||
|
||||
if (!pcard)
|
||||
return -ENXIO;
|
||||
|
||||
rv = kstrtol(buf, 0, &wr_val);
|
||||
if (rv < 0)
|
||||
return rv;
|
||||
|
Loading…
Reference in New Issue
Block a user