fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / pnp / interface.c
index 53fac8b..ac9fcd4 100644 (file)
@@ -205,7 +205,7 @@ static void pnp_print_option(pnp_info_buffer_t *buffer, char *space,
 }
 
 
-static ssize_t pnp_show_options(struct device *dmdev, char *buf)
+static ssize_t pnp_show_options(struct device *dmdev, struct device_attribute *attr, char *buf)
 {
        struct pnp_dev *dev = to_pnp_dev(dmdev);
        struct pnp_option * independent = dev->independent;
@@ -236,7 +236,7 @@ static ssize_t pnp_show_options(struct device *dmdev, char *buf)
 static DEVICE_ATTR(options,S_IRUGO,pnp_show_options,NULL);
 
 
-static ssize_t pnp_show_current_resources(struct device *dmdev, char *buf)
+static ssize_t pnp_show_current_resources(struct device *dmdev, struct device_attribute *attr, char *buf)
 {
        struct pnp_dev *dev = to_pnp_dev(dmdev);
        int i, ret;
@@ -264,9 +264,9 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, char *buf)
                        if (pnp_port_flags(dev, i) & IORESOURCE_DISABLED)
                                pnp_printf(buffer," disabled\n");
                        else
-                               pnp_printf(buffer," 0x%lx-0x%lx\n",
-                                               pnp_port_start(dev, i),
-                                               pnp_port_end(dev, i));
+                               pnp_printf(buffer," 0x%llx-0x%llx\n",
+                                       (unsigned long long)pnp_port_start(dev, i),
+                                       (unsigned long long)pnp_port_end(dev, i));
                }
        }
        for (i = 0; i < PNP_MAX_MEM; i++) {
@@ -275,9 +275,9 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, char *buf)
                        if (pnp_mem_flags(dev, i) & IORESOURCE_DISABLED)
                                pnp_printf(buffer," disabled\n");
                        else
-                               pnp_printf(buffer," 0x%lx-0x%lx\n",
-                                               pnp_mem_start(dev, i),
-                                               pnp_mem_end(dev, i));
+                               pnp_printf(buffer," 0x%llx-0x%llx\n",
+                                       (unsigned long long)pnp_mem_start(dev, i),
+                                       (unsigned long long)pnp_mem_end(dev, i));
                }
        }
        for (i = 0; i < PNP_MAX_IRQ; i++) {
@@ -286,8 +286,8 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, char *buf)
                        if (pnp_irq_flags(dev, i) & IORESOURCE_DISABLED)
                                pnp_printf(buffer," disabled\n");
                        else
-                               pnp_printf(buffer," %ld\n",
-                                               pnp_irq(dev, i));
+                               pnp_printf(buffer," %lld\n",
+                                       (unsigned long long)pnp_irq(dev, i));
                }
        }
        for (i = 0; i < PNP_MAX_DMA; i++) {
@@ -296,8 +296,8 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, char *buf)
                        if (pnp_dma_flags(dev, i) & IORESOURCE_DISABLED)
                                pnp_printf(buffer," disabled\n");
                        else
-                               pnp_printf(buffer," %ld\n",
-                                               pnp_dma(dev, i));
+                               pnp_printf(buffer," %lld\n",
+                                       (unsigned long long)pnp_dma(dev, i));
                }
        }
        ret = (buffer->curr - buf);
@@ -308,7 +308,7 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, char *buf)
 extern struct semaphore pnp_res_mutex;
 
 static ssize_t
-pnp_set_current_resources(struct device * dmdev, const char * ubuf, size_t count)
+pnp_set_current_resources(struct device * dmdev, struct device_attribute *attr, const char * ubuf, size_t count)
 {
        struct pnp_dev *dev = to_pnp_dev(dmdev);
        char    *buf = (void *)ubuf;
@@ -444,7 +444,7 @@ pnp_set_current_resources(struct device * dmdev, const char * ubuf, size_t count
 static DEVICE_ATTR(resources,S_IRUGO | S_IWUSR,
                   pnp_show_current_resources,pnp_set_current_resources);
 
-static ssize_t pnp_show_current_ids(struct device *dmdev, char *buf)
+static ssize_t pnp_show_current_ids(struct device *dmdev, struct device_attribute *attr, char *buf)
 {
        char *str = buf;
        struct pnp_dev *dev = to_pnp_dev(dmdev);
@@ -461,8 +461,19 @@ static DEVICE_ATTR(id,S_IRUGO,pnp_show_current_ids,NULL);
 
 int pnp_interface_attach_device(struct pnp_dev *dev)
 {
-       device_create_file(&dev->dev,&dev_attr_options);
-       device_create_file(&dev->dev,&dev_attr_resources);
-       device_create_file(&dev->dev,&dev_attr_id);
+       int rc = device_create_file(&dev->dev,&dev_attr_options);
+       if (rc) goto err;
+       rc = device_create_file(&dev->dev,&dev_attr_resources);
+       if (rc) goto err_opt;
+       rc = device_create_file(&dev->dev,&dev_attr_id);
+       if (rc) goto err_res;
+
        return 0;
+
+err_res:
+       device_remove_file(&dev->dev,&dev_attr_resources);
+err_opt:
+       device_remove_file(&dev->dev,&dev_attr_options);
+err:
+       return rc;
 }