#undef PARPORT_DEBUG_SHARING /* undef for production */
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/string.h>
#include <linux/threads.h>
#include <linux/kmod.h>
#include <linux/spinlock.h>
+#include <linux/mutex.h>
#include <asm/irq.h>
#undef PARPORT_PARANOID
static LIST_HEAD(drivers);
-static DECLARE_MUTEX(registration_lock);
+static DEFINE_MUTEX(registration_lock);
/* What you can do to a port that's gone away.. */
static void dead_write_lines (struct parport *p, unsigned char b){}
if (list_empty(&portlist))
get_lowlevel_driver ();
- down(®istration_lock);
+ mutex_lock(®istration_lock);
list_for_each_entry(port, &portlist, list)
drv->attach(port);
list_add(&drv->list, &drivers);
- up(®istration_lock);
+ mutex_unlock(®istration_lock);
return 0;
}
{
struct parport *port;
- down(®istration_lock);
+ mutex_lock(®istration_lock);
list_del_init(&drv->list);
list_for_each_entry(port, &portlist, list)
drv->detach(port);
- up(®istration_lock);
+ mutex_unlock(®istration_lock);
}
static void free_port (struct parport *port)
list_del(&port->full_list);
spin_unlock(&full_list_lock);
for (d = 0; d < 5; d++) {
- if (port->probe_info[d].class_name)
- kfree (port->probe_info[d].class_name);
- if (port->probe_info[d].mfr)
- kfree (port->probe_info[d].mfr);
- if (port->probe_info[d].model)
- kfree (port->probe_info[d].model);
- if (port->probe_info[d].cmdset)
- kfree (port->probe_info[d].cmdset);
- if (port->probe_info[d].description)
- kfree (port->probe_info[d].description);
+ kfree(port->probe_info[d].class_name);
+ kfree(port->probe_info[d].mfr);
+ kfree(port->probe_info[d].model);
+ kfree(port->probe_info[d].cmdset);
+ kfree(port->probe_info[d].description);
}
kfree(port->name);
* parport_get_port - increment a port's reference count
* @port: the port
*
- * This ensure's that a struct parport pointer remains valid
+ * This ensures that a struct parport pointer remains valid
* until the matching parport_put_port() call.
**/
#endif
parport_proc_register(port);
- down(®istration_lock);
+ mutex_lock(®istration_lock);
spin_lock_irq(&parportlist_lock);
list_add_tail(&port->list, &portlist);
for (i = 1; i < 3; i++) {
if (slave)
attach_driver_chain(slave);
}
- up(®istration_lock);
+ mutex_unlock(®istration_lock);
}
/**
{
int i;
- down(®istration_lock);
+ mutex_lock(®istration_lock);
/* Spread the word. */
detach_driver_chain (port);
}
spin_unlock(&parportlist_lock);
- up(®istration_lock);
+ mutex_unlock(®istration_lock);
parport_proc_unregister(port);
struct pardevice *
parport_register_device(struct parport *port, const char *name,
int (*pf)(void *), void (*kf)(void *),
- void (*irq_func)(int, void *, struct pt_regs *),
+ void (*irq_func)(int, void *),
int flags, void *handle)
{
struct pardevice *tmp;
return tmp;
out_free_all:
- kfree (tmp->state);
+ kfree(tmp->state);
out_free_pardevice:
- kfree (tmp);
+ kfree(tmp);
out:
parport_put_port (port);
module_put(port->ops->owner);
EXPORT_SYMBOL(parport_unregister_driver);
EXPORT_SYMBOL(parport_register_device);
EXPORT_SYMBOL(parport_unregister_device);
+EXPORT_SYMBOL(parport_get_port);
EXPORT_SYMBOL(parport_put_port);
EXPORT_SYMBOL(parport_find_number);
EXPORT_SYMBOL(parport_find_base);