From aeb5d727062a0238a2f96c9c380fbd2be4640c6f Mon Sep 17 00:00:00 2001 From: Al Viro Date: Tue, 2 Sep 2008 15:28:45 -0400 Subject: [PATCH] introduce fmode_t, do annotations Signed-off-by: Al Viro --- drivers/char/nvram.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/char') diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c index 39f6357e3b5..8054ee839b3 100644 --- a/drivers/char/nvram.c +++ b/drivers/char/nvram.c @@ -338,7 +338,7 @@ nvram_open(struct inode *inode, struct file *file) if ((nvram_open_cnt && (file->f_flags & O_EXCL)) || (nvram_open_mode & NVRAM_EXCL) || - ((file->f_mode & 2) && (nvram_open_mode & NVRAM_WRITE))) { + ((file->f_mode & FMODE_WRITE) && (nvram_open_mode & NVRAM_WRITE))) { spin_unlock(&nvram_state_lock); unlock_kernel(); return -EBUSY; @@ -346,7 +346,7 @@ nvram_open(struct inode *inode, struct file *file) if (file->f_flags & O_EXCL) nvram_open_mode |= NVRAM_EXCL; - if (file->f_mode & 2) + if (file->f_mode & FMODE_WRITE) nvram_open_mode |= NVRAM_WRITE; nvram_open_cnt++; @@ -366,7 +366,7 @@ nvram_release(struct inode *inode, struct file *file) /* if only one instance is open, clear the EXCL bit */ if (nvram_open_mode & NVRAM_EXCL) nvram_open_mode &= ~NVRAM_EXCL; - if (file->f_mode & 2) + if (file->f_mode & FMODE_WRITE) nvram_open_mode &= ~NVRAM_WRITE; spin_unlock(&nvram_state_lock); -- cgit v1.2.3 From 9a1c3542768b5a58e45a9216921cd10a3bae1205 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 22 Feb 2008 20:40:24 -0500 Subject: [PATCH] pass fmode_t to blkdev_put() Signed-off-by: Al Viro --- drivers/char/raw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/char') diff --git a/drivers/char/raw.c b/drivers/char/raw.c index e139372d0e6..bfd59e6bf54 100644 --- a/drivers/char/raw.c +++ b/drivers/char/raw.c @@ -87,7 +87,7 @@ static int raw_open(struct inode *inode, struct file *filp) out2: bd_release(bdev); out1: - blkdev_put(bdev); + blkdev_put(bdev, filp->f_mode); out: mutex_unlock(&raw_mutex); return err; @@ -112,7 +112,7 @@ static int raw_release(struct inode *inode, struct file *filp) mutex_unlock(&raw_mutex); bd_release(bdev); - blkdev_put(bdev); + blkdev_put(bdev, filp->f_mode); return 0; } -- cgit v1.2.3 From 572c48921574dbe6dceb958cf965aa962baefde4 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Mon, 8 Oct 2007 13:24:05 -0400 Subject: [PATCH] sanitize blkdev_get() and friends * get rid of fake struct file/struct dentry in __blkdev_get() * merge __blkdev_get() and do_open() * get rid of flags argument of blkdev_get() Signed-off-by: Al Viro --- drivers/char/raw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/char') diff --git a/drivers/char/raw.c b/drivers/char/raw.c index bfd59e6bf54..f3cf5eb9b7f 100644 --- a/drivers/char/raw.c +++ b/drivers/char/raw.c @@ -65,7 +65,7 @@ static int raw_open(struct inode *inode, struct file *filp) if (!bdev) goto out; igrab(bdev->bd_inode); - err = blkdev_get(bdev, filp->f_mode, 0); + err = blkdev_get(bdev, filp->f_mode); if (err) goto out; err = bd_claim(bdev, raw_open); -- cgit v1.2.3 From 56b26add02b4bdea81d5e0ebda60db1fe3311ad4 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 19 Sep 2008 03:17:36 -0400 Subject: [PATCH] kill the rest of struct file propagation in block ioctls Now we can switch blkdev_ioctl() block_device/mode Signed-off-by: Al Viro --- drivers/char/raw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/char') diff --git a/drivers/char/raw.c b/drivers/char/raw.c index f3cf5eb9b7f..96adf28a17e 100644 --- a/drivers/char/raw.c +++ b/drivers/char/raw.c @@ -125,7 +125,7 @@ raw_ioctl(struct inode *inode, struct file *filp, { struct block_device *bdev = filp->private_data; - return blkdev_ioctl(bdev->bd_inode, NULL, command, arg); + return blkdev_ioctl(bdev, 0, command, arg); } static void bind_device(struct raw_config_request *rq) -- cgit v1.2.3 From fc362e2e0efd8b652ebfb409a4e43e6189c04f6f Mon Sep 17 00:00:00 2001 From: Hendrik Brueckner Date: Mon, 13 Oct 2008 23:12:48 +0000 Subject: hvc_console: Add a hangup notifier for backends I have added a hangup notifier that can be used by hvc console backends to handle a tty hangup. The default irq hangup notifier calls the notifier_del_irq() for compatibility. Acked-by: Christian Borntraeger Signed-off-by: Hendrik Brueckner Signed-off-by: Benjamin Herrenschmidt --- drivers/char/hvc_console.c | 4 ++-- drivers/char/hvc_console.h | 4 +++- drivers/char/hvc_irq.c | 5 +++++ drivers/char/hvc_iseries.c | 1 + drivers/char/hvc_vio.c | 1 + drivers/char/hvc_xen.c | 1 + drivers/char/virtio_console.c | 1 + 7 files changed, 14 insertions(+), 3 deletions(-) (limited to 'drivers/char') diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index bf70450a49c..5c9750ed0bc 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c @@ -418,8 +418,8 @@ static void hvc_hangup(struct tty_struct *tty) spin_unlock_irqrestore(&hp->lock, flags); - if (hp->ops->notifier_del) - hp->ops->notifier_del(hp, hp->data); + if (hp->ops->notifier_hangup) + hp->ops->notifier_hangup(hp, hp->data); while(temp_open_count) { --temp_open_count; diff --git a/drivers/char/hvc_console.h b/drivers/char/hvc_console.h index 9790201718a..ec0e9bb0e5e 100644 --- a/drivers/char/hvc_console.h +++ b/drivers/char/hvc_console.h @@ -65,9 +65,10 @@ struct hv_ops { int (*get_chars)(uint32_t vtermno, char *buf, int count); int (*put_chars)(uint32_t vtermno, const char *buf, int count); - /* Callbacks for notification. Called in open and close */ + /* Callbacks for notification. Called in open, close and hangup */ int (*notifier_add)(struct hvc_struct *hp, int irq); void (*notifier_del)(struct hvc_struct *hp, int irq); + void (*notifier_hangup)(struct hvc_struct *hp, int irq); }; /* Register a vterm and a slot index for use as a console (console_init) */ @@ -86,6 +87,7 @@ void hvc_kick(void); /* default notifier for irq based notification */ extern int notifier_add_irq(struct hvc_struct *hp, int data); extern void notifier_del_irq(struct hvc_struct *hp, int data); +extern void notifier_hangup_irq(struct hvc_struct *hp, int data); #if defined(CONFIG_XMON) && defined(CONFIG_SMP) diff --git a/drivers/char/hvc_irq.c b/drivers/char/hvc_irq.c index 73a59cdb894..d09e5688d44 100644 --- a/drivers/char/hvc_irq.c +++ b/drivers/char/hvc_irq.c @@ -42,3 +42,8 @@ void notifier_del_irq(struct hvc_struct *hp, int irq) free_irq(irq, hp); hp->irq_requested = 0; } + +void notifier_hangup_irq(struct hvc_struct *hp, int irq) +{ + notifier_del_irq(hp, irq); +} diff --git a/drivers/char/hvc_iseries.c b/drivers/char/hvc_iseries.c index b71c610fe5a..b74a2f8ab90 100644 --- a/drivers/char/hvc_iseries.c +++ b/drivers/char/hvc_iseries.c @@ -202,6 +202,7 @@ static struct hv_ops hvc_get_put_ops = { .put_chars = put_chars, .notifier_add = notifier_add_irq, .notifier_del = notifier_del_irq, + .notifier_hangup = notifier_hangup_irq, }; static int __devinit hvc_vio_probe(struct vio_dev *vdev, diff --git a/drivers/char/hvc_vio.c b/drivers/char/hvc_vio.c index 93f3840c168..019e0b58593 100644 --- a/drivers/char/hvc_vio.c +++ b/drivers/char/hvc_vio.c @@ -82,6 +82,7 @@ static struct hv_ops hvc_get_put_ops = { .put_chars = hvc_put_chars, .notifier_add = notifier_add_irq, .notifier_del = notifier_del_irq, + .notifier_hangup = notifier_hangup_irq, }; static int __devinit hvc_vio_probe(struct vio_dev *vdev, diff --git a/drivers/char/hvc_xen.c b/drivers/char/hvc_xen.c index 538ceea5e7d..eba999f8598 100644 --- a/drivers/char/hvc_xen.c +++ b/drivers/char/hvc_xen.c @@ -102,6 +102,7 @@ static struct hv_ops hvc_ops = { .put_chars = write_console, .notifier_add = notifier_add_irq, .notifier_del = notifier_del_irq, + .notifier_hangup = notifier_hangup_irq, }; static int __init xen_init(void) diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index d0f4eb6fdb7..3fb0d2c88ba 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -198,6 +198,7 @@ static int __devinit virtcons_probe(struct virtio_device *dev) virtio_cons.put_chars = put_chars; virtio_cons.notifier_add = notifier_add_vio; virtio_cons.notifier_del = notifier_del_vio; + virtio_cons.notifier_hangup = notifier_del_vio; /* The first argument of hvc_alloc() is the virtual console number, so * we use zero. The second argument is the parameter for the -- cgit v1.2.3 From 56ce9e2b2463b3b257098aa966586701d9967f1e Mon Sep 17 00:00:00 2001 From: Hendrik Brueckner Date: Mon, 13 Oct 2008 23:12:49 +0000 Subject: hvc_console: Add tty driver flag TTY_DRIVER_RESET_TERMIOS After a tty hangup() or close() operation, processes might not reset the termio settings to a sane state. In order to reset the termios to its default settings the tty driver flag TTY_DRIVER_RESET_TERMIOS has been added. TTY driver flag description from include/linux/tty_driver.h: TTY_DRIVER_RESET_TERMIOS --- requests the tty layer to reset the termios setting when the last process has closed the device. Used for PTY's, in particular. Acked-by: Christian Borntraeger Signed-off-by: Hendrik Brueckner Signed-off-by: Benjamin Herrenschmidt --- drivers/char/hvc_console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/char') diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index 5c9750ed0bc..c9d16665c96 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c @@ -796,7 +796,7 @@ static int hvc_init(void) drv->minor_start = HVC_MINOR; drv->type = TTY_DRIVER_TYPE_SYSTEM; drv->init_termios = tty_std_termios; - drv->flags = TTY_DRIVER_REAL_RAW; + drv->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_RESET_TERMIOS; tty_set_operations(drv, &hvc_ops); /* Always start the kthread because there can be hotplug vty adapters -- cgit v1.2.3 From 3feebbb5492e9e463467cefb633e23a3dfcec132 Mon Sep 17 00:00:00 2001 From: Hendrik Brueckner Date: Mon, 13 Oct 2008 23:12:50 +0000 Subject: hvc_console: Fix loop if put_char() returns 0 If put_char() routine of a hvc console backend returns 0, then the hvc console starts looping in the following scenarios: 1. hvc_console_print() If put_char() returns 0 then the while loop may loop forever. I have added the missing check for 0 to throw away console messages. 2. khvcd may loop: The thread calls hvc_poll() --> hvc_push()... if there are still buffered data then the HVC_POLL_WRITE bit is set and causes the khvcd thread to loop (if yield() returns immediately). However, instead of looping, the khvcd thread could sleep for MIN_TIMEOUT (doing the same as for get_chars()). The MIN_TIMEOUT is set if hvc_push() was not able to write data to the backend. If data has been written, the timeout is set to 0 to immediately re-schedule hvc_poll(). Reviewed-by: Christian Borntraeger Tested-by: Christian Borntraeger (virtio_console) Signed-off-by: Hendrik Brueckner Signed-off-by: Benjamin Herrenschmidt --- drivers/char/hvc_console.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'drivers/char') diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index c9d16665c96..3650c904401 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c @@ -161,7 +161,7 @@ static void hvc_console_print(struct console *co, const char *b, } } else { r = cons_ops[index]->put_chars(vtermnos[index], c, i); - if (r < 0) { + if (r <= 0) { /* throw away chars on error */ i = 0; } else if (r > 0) { @@ -431,7 +431,7 @@ static void hvc_hangup(struct tty_struct *tty) * Push buffered characters whether they were just recently buffered or waiting * on a blocked hypervisor. Call this function with hp->lock held. */ -static void hvc_push(struct hvc_struct *hp) +static int hvc_push(struct hvc_struct *hp) { int n; @@ -439,7 +439,7 @@ static void hvc_push(struct hvc_struct *hp) if (n <= 0) { if (n == 0) { hp->do_wakeup = 1; - return; + return 0; } /* throw away output on error; this happens when there is no session connected to the vterm. */ @@ -450,6 +450,8 @@ static void hvc_push(struct hvc_struct *hp) memmove(hp->outbuf, hp->outbuf + n, hp->n_outbuf); else hp->do_wakeup = 1; + + return n; } static int hvc_write(struct tty_struct *tty, const unsigned char *buf, int count) @@ -538,16 +540,20 @@ int hvc_poll(struct hvc_struct *hp) char buf[N_INBUF] __ALIGNED__; unsigned long flags; int read_total = 0; + int written_total = 0; spin_lock_irqsave(&hp->lock, flags); /* Push pending writes */ if (hp->n_outbuf > 0) - hvc_push(hp); + written_total = hvc_push(hp); /* Reschedule us if still some write pending */ - if (hp->n_outbuf > 0) + if (hp->n_outbuf > 0) { poll_mask |= HVC_POLL_WRITE; + /* If hvc_push() was not able to write, sleep a few msecs */ + timeout = (written_total) ? 0 : MIN_TIMEOUT; + } /* No tty attached, just skip */ tty = hp->tty; @@ -659,10 +665,6 @@ static int khvcd(void *unused) poll_mask |= HVC_POLL_READ; if (hvc_kicked) continue; - if (poll_mask & HVC_POLL_WRITE) { - yield(); - continue; - } set_current_state(TASK_INTERRUPTIBLE); if (!hvc_kicked) { if (poll_mask == 0) -- cgit v1.2.3 From febde3711992a64ea83a47a719f68a90c4b0927a Mon Sep 17 00:00:00 2001 From: Hendrik Brueckner Date: Tue, 14 Oct 2008 05:02:09 +0000 Subject: hvc_console: Add support for tty window resizing The patch provides the hvc_resize() function to update the terminal window dimensions (struct winsize) for a specified hvc console. The function stores the new window size and schedules a function that finally updates the tty winsize and signals the change to user space (SIGWINCH). Because the winsize update must acquire a mutex and might sleep, the function is scheduled instead of being called from hvc_poll() or khvcd. This patch uses the tty_do_resize() routine from the tty layer. A pending resize work is canceled in hvc_close() and hvc_hangup(). Signed-off-by: Hendrik Brueckner Signed-off-by: Benjamin Herrenschmidt --- drivers/char/hvc_console.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++ drivers/char/hvc_console.h | 6 +++++ 2 files changed, 64 insertions(+) (limited to 'drivers/char') diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index 3650c904401..2d256dc8052 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c @@ -374,6 +374,9 @@ static void hvc_close(struct tty_struct *tty, struct file * filp) if (hp->ops->notifier_del) hp->ops->notifier_del(hp, hp->data); + /* cancel pending tty resize work */ + cancel_work_sync(&hp->tty_resize); + /* * Chain calls chars_in_buffer() and returns immediately if * there is no buffered data otherwise sleeps on a wait queue @@ -399,6 +402,9 @@ static void hvc_hangup(struct tty_struct *tty) if (!hp) return; + /* cancel pending tty resize work */ + cancel_work_sync(&hp->tty_resize); + spin_lock_irqsave(&hp->lock, flags); /* @@ -494,6 +500,39 @@ static int hvc_write(struct tty_struct *tty, const unsigned char *buf, int count return written; } +/** + * hvc_set_winsz() - Resize the hvc tty terminal window. + * @work: work structure. + * + * The routine shall not be called within an atomic context because it + * might sleep. + * + * Locking: hp->lock + */ +static void hvc_set_winsz(struct work_struct *work) +{ + struct hvc_struct *hp; + unsigned long hvc_flags; + struct tty_struct *tty; + struct winsize ws; + + hp = container_of(work, struct hvc_struct, tty_resize); + if (!hp) + return; + + spin_lock_irqsave(&hp->lock, hvc_flags); + if (!hp->tty) { + spin_unlock_irqrestore(&hp->lock, hvc_flags); + return; + } + ws = hp->ws; + tty = tty_kref_get(hp->tty); + spin_unlock_irqrestore(&hp->lock, hvc_flags); + + tty_do_resize(tty, tty, &ws); + tty_kref_put(tty); +} + /* * This is actually a contract between the driver and the tty layer outlining * how much write room the driver can guarantee will be sent OR BUFFERED. This @@ -638,6 +677,24 @@ int hvc_poll(struct hvc_struct *hp) } EXPORT_SYMBOL_GPL(hvc_poll); +/** + * hvc_resize() - Update terminal window size information. + * @hp: HVC console pointer + * @ws: Terminal window size structure + * + * Stores the specified window size information in the hvc structure of @hp. + * The function schedule the tty resize update. + * + * Locking: Locking free; the function MUST be called holding hp->lock + */ +void hvc_resize(struct hvc_struct *hp, struct winsize ws) +{ + if ((hp->ws.ws_row != ws.ws_row) || (hp->ws.ws_col != ws.ws_col)) { + hp->ws = ws; + schedule_work(&hp->tty_resize); + } +} + /* * This kthread is either polling or interrupt driven. This is determined by * calling hvc_poll() who determines whether a console adapter support @@ -720,6 +777,7 @@ struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int data, kref_init(&hp->kref); + INIT_WORK(&hp->tty_resize, hvc_set_winsz); spin_lock_init(&hp->lock); spin_lock(&hvc_structs_lock); diff --git a/drivers/char/hvc_console.h b/drivers/char/hvc_console.h index ec0e9bb0e5e..e3359f3c9b2 100644 --- a/drivers/char/hvc_console.h +++ b/drivers/char/hvc_console.h @@ -27,6 +27,7 @@ #ifndef HVC_CONSOLE_H #define HVC_CONSOLE_H #include +#include /* * This is the max number of console adapters that can/will be found as @@ -56,6 +57,8 @@ struct hvc_struct { struct hv_ops *ops; int irq_requested; int data; + struct winsize ws; + struct work_struct tty_resize; struct list_head next; struct kref kref; /* ref count & hvc_struct lifetime */ }; @@ -84,6 +87,9 @@ extern int __devexit hvc_remove(struct hvc_struct *hp); int hvc_poll(struct hvc_struct *hp); void hvc_kick(void); +/* Resize hvc tty terminal window */ +extern void hvc_resize(struct hvc_struct *hp, struct winsize ws); + /* default notifier for irq based notification */ extern int notifier_add_irq(struct hvc_struct *hp, int data); extern void notifier_del_irq(struct hvc_struct *hp, int data); -- cgit v1.2.3 From 934752d8a4aaae4bee7a1b46944f30a55178ec91 Mon Sep 17 00:00:00 2001 From: Hendrik Brueckner Date: Mon, 13 Oct 2008 23:12:52 +0000 Subject: hvc_console: Remove __devexit annotation of hvc_remove() Removed __devexit annotation of hvc_remove() to avoid a section mismatch if the backend initialization fails and hvc_remove() must be used to clean up allocated hvc structs (called in section __init or __devinit). Acked-by: Christian Borntraeger Signed-off-by: Hendrik Brueckner Signed-off-by: Benjamin Herrenschmidt --- drivers/char/hvc_console.c | 2 +- drivers/char/hvc_console.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/char') diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index 2d256dc8052..5b819b12675 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c @@ -803,7 +803,7 @@ struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int data, } EXPORT_SYMBOL_GPL(hvc_alloc); -int __devexit hvc_remove(struct hvc_struct *hp) +int hvc_remove(struct hvc_struct *hp) { unsigned long flags; struct tty_struct *tty; diff --git a/drivers/char/hvc_console.h b/drivers/char/hvc_console.h index e3359f3c9b2..8297dbc2e6e 100644 --- a/drivers/char/hvc_console.h +++ b/drivers/char/hvc_console.h @@ -81,7 +81,7 @@ extern int hvc_instantiate(uint32_t vtermno, int index, struct hv_ops *ops); extern struct hvc_struct * __devinit hvc_alloc(uint32_t vtermno, int data, struct hv_ops *ops, int outbuf_size); /* remove a vterm from hvc tty operation (module_exit or hotplug remove) */ -extern int __devexit hvc_remove(struct hvc_struct *hp); +extern int hvc_remove(struct hvc_struct *hp); /* data available */ int hvc_poll(struct hvc_struct *hp); -- cgit v1.2.3 From cb4bca3540535a15705b50bdaea4fe2fddd183b3 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 21 Oct 2008 13:47:44 +0100 Subject: tty: Fix tty_port kref screwup Pass the brown paper bags please. I changed the semantics of this so the function was supposed to do the extra kref itself then forgot to do the change.. duh.... Signed-off-by: Alan Cox Signed-off-by: Linus Torvalds --- drivers/char/tty_port.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/char') diff --git a/drivers/char/tty_port.c b/drivers/char/tty_port.c index 553b0e9d8d1..c8f8024cb40 100644 --- a/drivers/char/tty_port.c +++ b/drivers/char/tty_port.c @@ -90,7 +90,7 @@ void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty) spin_lock_irqsave(&port->lock, flags); if (port->tty) tty_kref_put(port->tty); - port->tty = tty; + port->tty = tty_kref_get(tty); spin_unlock_irqrestore(&port->lock, flags); } EXPORT_SYMBOL(tty_port_tty_set); -- cgit v1.2.3 From d1a35e4d74d070b06163e435e590ca90a2420b9e Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Sun, 26 Oct 2008 19:51:14 +0100 Subject: m68k: Disable Amiga serial console support if modular If CONFIG_AMIGA_BUILTIN_SERIAL=m, I get the following warnings: | drivers/char/amiserial.c: At top level: | drivers/char/amiserial.c:2138: warning: data definition has no type or storage class | drivers/char/amiserial.c:2138: warning: type defaults to 'int' in declaration of 'console_initcall' | drivers/char/amiserial.c:2138: warning: parameter names (without types) in function declaration | drivers/char/amiserial.c:2134: warning: 'amiserial_console_init' defined but not used because console_initcall() is not defined (nor really sensible) in the modular case. So disable serial console support if the driver is modular. Signed-off-by: Geert Uytterhoeven Signed-off-by: Linus Torvalds --- drivers/char/amiserial.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/char') diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c index 98821f97583..b97aebd7aeb 100644 --- a/drivers/char/amiserial.c +++ b/drivers/char/amiserial.c @@ -2071,12 +2071,13 @@ module_init(rs_init) module_exit(rs_exit) +#if defined(CONFIG_SERIAL_CONSOLE) && !defined(MODULE) + /* * ------------------------------------------------------------ * Serial console driver * ------------------------------------------------------------ */ -#ifdef CONFIG_SERIAL_CONSOLE static void amiga_serial_putc(char c) { @@ -2130,6 +2131,7 @@ static int __init amiserial_console_init(void) return 0; } console_initcall(amiserial_console_init); -#endif + +#endif /* CONFIG_SERIAL_CONSOLE && !MODULE */ MODULE_LICENSE("GPL"); -- cgit v1.2.3