eisa: fix coding style for eisa bus code
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com> Cc: Kay Sievers <kay.sievers@vrfy.org> Cc: Greg Kroah-Hartman <gregkh@suse.de> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
08d9e7363b
commit
33fd797b3e
|
@ -141,19 +141,23 @@ struct bus_type eisa_bus_type = {
|
|||
.match = eisa_bus_match,
|
||||
.uevent = eisa_bus_uevent,
|
||||
};
|
||||
EXPORT_SYMBOL(eisa_bus_type);
|
||||
|
||||
int eisa_driver_register(struct eisa_driver *edrv)
|
||||
{
|
||||
edrv->driver.bus = &eisa_bus_type;
|
||||
return driver_register(&edrv->driver);
|
||||
}
|
||||
EXPORT_SYMBOL(eisa_driver_register);
|
||||
|
||||
void eisa_driver_unregister(struct eisa_driver *edrv)
|
||||
{
|
||||
driver_unregister(&edrv->driver);
|
||||
}
|
||||
EXPORT_SYMBOL(eisa_driver_unregister);
|
||||
|
||||
static ssize_t eisa_show_sig (struct device *dev, struct device_attribute *attr, char *buf)
|
||||
static ssize_t eisa_show_sig(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct eisa_device *edev = to_eisa_device(dev);
|
||||
return sprintf(buf, "%s\n", edev->id.sig);
|
||||
|
@ -161,7 +165,9 @@ static ssize_t eisa_show_sig (struct device *dev, struct device_attribute *attr,
|
|||
|
||||
static DEVICE_ATTR(signature, S_IRUGO, eisa_show_sig, NULL);
|
||||
|
||||
static ssize_t eisa_show_state (struct device *dev, struct device_attribute *attr, char *buf)
|
||||
static ssize_t eisa_show_state(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct eisa_device *edev = to_eisa_device(dev);
|
||||
return sprintf(buf, "%d\n", edev->state & EISA_CONFIG_ENABLED);
|
||||
|
@ -169,7 +175,9 @@ static ssize_t eisa_show_state (struct device *dev, struct device_attribute *att
|
|||
|
||||
static DEVICE_ATTR(enabled, S_IRUGO, eisa_show_state, NULL);
|
||||
|
||||
static ssize_t eisa_show_modalias (struct device *dev, struct device_attribute *attr, char *buf)
|
||||
static ssize_t eisa_show_modalias(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct eisa_device *edev = to_eisa_device(dev);
|
||||
return sprintf(buf, EISA_DEVICE_MODALIAS_FMT "\n", edev->id.sig);
|
||||
|
@ -187,12 +195,14 @@ static int __init eisa_init_device (struct eisa_root_device *root,
|
|||
|
||||
sig_addr = SLOT_ADDRESS(root, slot) + EISA_VENDOR_ID_OFFSET;
|
||||
|
||||
if (!(sig = decode_eisa_sig (sig_addr)))
|
||||
sig = decode_eisa_sig(sig_addr);
|
||||
if (!sig)
|
||||
return -1; /* No EISA device here */
|
||||
|
||||
memcpy(edev->id.sig, sig, EISA_SIG_LEN);
|
||||
edev->slot = slot;
|
||||
edev->state = inb (SLOT_ADDRESS (root, slot) + EISA_CONFIG_OFFSET) & EISA_CONFIG_ENABLED;
|
||||
edev->state = inb(SLOT_ADDRESS(root, slot) + EISA_CONFIG_OFFSET)
|
||||
& EISA_CONFIG_ENABLED;
|
||||
edev->base_addr = SLOT_ADDRESS(root, slot);
|
||||
edev->dma_mask = root->dma_mask; /* Default DMA mask */
|
||||
eisa_name_device(edev);
|
||||
|
@ -226,11 +236,14 @@ static int __init eisa_register_device (struct eisa_device *edev)
|
|||
return rc;
|
||||
|
||||
rc = device_create_file(&edev->dev, &dev_attr_signature);
|
||||
if (rc) goto err_devreg;
|
||||
if (rc)
|
||||
goto err_devreg;
|
||||
rc = device_create_file(&edev->dev, &dev_attr_enabled);
|
||||
if (rc) goto err_sig;
|
||||
if (rc)
|
||||
goto err_sig;
|
||||
rc = device_create_file(&edev->dev, &dev_attr_modalias);
|
||||
if (rc) goto err_enab;
|
||||
if (rc)
|
||||
goto err_enab;
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -263,12 +276,14 @@ static int __init eisa_request_resources (struct eisa_root_device *root,
|
|||
|
||||
if (slot) {
|
||||
edev->res[i].name = NULL;
|
||||
edev->res[i].start = SLOT_ADDRESS (root, slot) + (i * 0x400);
|
||||
edev->res[i].start = SLOT_ADDRESS(root, slot)
|
||||
+ (i * 0x400);
|
||||
edev->res[i].end = edev->res[i].start + 0xff;
|
||||
edev->res[i].flags = IORESOURCE_IO;
|
||||
} else {
|
||||
edev->res[i].name = NULL;
|
||||
edev->res[i].start = SLOT_ADDRESS (root, slot) + EISA_VENDOR_ID_OFFSET;
|
||||
edev->res[i].start = SLOT_ADDRESS(root, slot)
|
||||
+ EISA_VENDOR_ID_OFFSET;
|
||||
edev->res[i].end = edev->res[i].start + 3;
|
||||
edev->res[i].flags = IORESOURCE_BUSY;
|
||||
}
|
||||
|
@ -306,7 +321,8 @@ static int __init eisa_probe (struct eisa_root_device *root)
|
|||
/* First try to get hold of slot 0. If there is no device
|
||||
* here, simply fail, unless root->force_probe is set. */
|
||||
|
||||
if (!(edev = kzalloc (sizeof (*edev), GFP_KERNEL))) {
|
||||
edev = kzalloc(sizeof(*edev), GFP_KERNEL);
|
||||
if (!edev) {
|
||||
printk(KERN_ERR "EISA: Couldn't allocate mainboard slot\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
@ -340,9 +356,9 @@ static int __init eisa_probe (struct eisa_root_device *root)
|
|||
force_probe:
|
||||
|
||||
for (c = 0, i = 1; i <= root->slots; i++) {
|
||||
if (!(edev = kzalloc (sizeof (*edev), GFP_KERNEL))) {
|
||||
printk (KERN_ERR "EISA: Out of memory for slot %d\n",
|
||||
i);
|
||||
edev = kzalloc(sizeof(*edev), GFP_KERNEL);
|
||||
if (!edev) {
|
||||
printk(KERN_ERR "EISA: Out of memory for slot %d\n", i);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -417,12 +433,14 @@ int __init eisa_root_register (struct eisa_root_device *root)
|
|||
root->eisa_root_res.end = root->res->end;
|
||||
root->eisa_root_res.flags = IORESOURCE_BUSY;
|
||||
|
||||
if ((err = request_resource (&eisa_root_res, &root->eisa_root_res)))
|
||||
err = request_resource(&eisa_root_res, &root->eisa_root_res);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
root->bus_nr = eisa_bus_count++;
|
||||
|
||||
if ((err = eisa_probe (root)))
|
||||
err = eisa_probe(root);
|
||||
if (err)
|
||||
release_resource(&root->eisa_root_res);
|
||||
|
||||
return err;
|
||||
|
@ -432,7 +450,8 @@ static int __init eisa_init (void)
|
|||
{
|
||||
int r;
|
||||
|
||||
if ((r = bus_register (&eisa_bus_type)))
|
||||
r = bus_register(&eisa_bus_type);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
printk(KERN_INFO "EISA bus registered\n");
|
||||
|
@ -446,6 +465,3 @@ postcore_initcall (eisa_init);
|
|||
|
||||
int EISA_bus; /* for legacy drivers */
|
||||
EXPORT_SYMBOL(EISA_bus);
|
||||
EXPORT_SYMBOL (eisa_bus_type);
|
||||
EXPORT_SYMBOL (eisa_driver_register);
|
||||
EXPORT_SYMBOL (eisa_driver_unregister);
|
||||
|
|
Loading…
Reference in New Issue