Skip to content

Commit

Permalink
um: Implement um_free_irq()
Browse files Browse the repository at this point in the history
Instead of using chip->release() we can achieve the same
using a simple wrapper for free_irq().
We have already um_request_irq(), so um_free_irq() is the perfect
counterpart.

Signed-off-by: Richard Weinberger <richard@nod.at>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Richard Weinberger committed May 21, 2012
1 parent 2b76eba commit fa7a044
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 10 deletions.
9 changes: 5 additions & 4 deletions arch/um/drivers/chan_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <linux/tty_flip.h>
#include "chan.h"
#include "os.h"
#include "irq_kern.h"

#ifdef CONFIG_NOCONFIG_CHAN
static void *not_configged_init(char *str, int device,
Expand Down Expand Up @@ -213,9 +214,9 @@ void free_irqs(void)
chan = list_entry(ele, struct chan, free_list);

if (chan->input && chan->enabled)
free_irq(chan->line->driver->read_irq, chan);
um_free_irq(chan->line->driver->read_irq, chan);
if (chan->output && chan->enabled)
free_irq(chan->line->driver->write_irq, chan);
um_free_irq(chan->line->driver->write_irq, chan);
chan->enabled = 0;
}
}
Expand All @@ -234,9 +235,9 @@ static void close_one_chan(struct chan *chan, int delay_free_irq)
}
else {
if (chan->input && chan->enabled)
free_irq(chan->line->driver->read_irq, chan);
um_free_irq(chan->line->driver->read_irq, chan);
if (chan->output && chan->enabled)
free_irq(chan->line->driver->write_irq, chan);
um_free_irq(chan->line->driver->write_irq, chan);
chan->enabled = 0;
}
if (chan->ops->close != NULL)
Expand Down
2 changes: 1 addition & 1 deletion arch/um/drivers/line.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ struct winch {
static void __free_winch(struct work_struct *work)
{
struct winch *winch = container_of(work, struct winch, work);
free_irq(WINCH_IRQ, winch);
um_free_irq(WINCH_IRQ, winch);

if (winch->pid != -1)
os_kill_process(winch->pid, 1);
Expand Down
4 changes: 2 additions & 2 deletions arch/um/drivers/net_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ static int uml_net_close(struct net_device *dev)

netif_stop_queue(dev);

free_irq(dev->irq, dev);
um_free_irq(dev->irq, dev);
if (lp->close != NULL)
(*lp->close)(lp->fd, &lp->user);
lp->fd = -1;
Expand Down Expand Up @@ -835,7 +835,7 @@ static void close_devices(void)
spin_lock(&opened_lock);
list_for_each(ele, &opened) {
lp = list_entry(ele, struct uml_net_private, list);
free_irq(lp->dev->irq, lp->dev);
um_free_irq(lp->dev->irq, lp->dev);
if ((lp->close != NULL) && (lp->fd >= 0))
(*lp->close)(lp->fd, &lp->user);
if (lp->remove != NULL)
Expand Down
2 changes: 1 addition & 1 deletion arch/um/drivers/port_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ int port_wait(void *data)
* connection. Then we loop here throwing out failed
* connections until a good one is found.
*/
free_irq(TELNETD_IRQ, conn);
um_free_irq(TELNETD_IRQ, conn);

if (conn->fd >= 0)
break;
Expand Down
2 changes: 1 addition & 1 deletion arch/um/drivers/xterm_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ int xterm_fd(int socket, int *pid_out)
* isn't set) this will hang... */
wait_for_completion(&data->ready);

free_irq(XTERM_IRQ, data);
um_free_irq(XTERM_IRQ, data);

ret = data->new_fd;
*pid_out = data->pid;
Expand Down
2 changes: 1 addition & 1 deletion arch/um/include/shared/irq_kern.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ extern int um_request_irq(unsigned int irq, int fd, int type,
irq_handler_t handler,
unsigned long irqflags, const char * devname,
void *dev_id);

void um_free_irq(unsigned int irq, void *dev);
#endif

7 changes: 7 additions & 0 deletions arch/um/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,13 @@ unsigned int do_IRQ(int irq, struct uml_pt_regs *regs)
return 1;
}

void um_free_irq(unsigned int irq, void *dev)
{
free_irq_by_irq_and_dev(irq, dev);
free_irq(irq, dev);
}
EXPORT_SYMBOL(um_free_irq);

int um_request_irq(unsigned int irq, int fd, int type,
irq_handler_t handler,
unsigned long irqflags, const char * devname,
Expand Down

0 comments on commit fa7a044

Please sign in to comment.