Re: [PATCH] WorkStruct: Fix S390 driver workstruct usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 08, 2006 at 02:59:40PM +0000, David Howells wrote:

> diff --git a/drivers/s390/char/ctrlchar.c b/drivers/s390/char/ctrlchar.c
> index 49e9628..9fcfe3a 100644
> --- a/drivers/s390/char/ctrlchar.c
> +++ b/drivers/s390/char/ctrlchar.c
> @@ -15,15 +15,16 @@ #include <linux/ctype.h>
>  #include "ctrlchar.h"
>  
>  #ifdef CONFIG_MAGIC_SYSRQ
> +static struct tty_struct *ctrlchar_sysrq_tty;
>  static int ctrlchar_sysrq_key;
>  
>  static void
> -ctrlchar_handle_sysrq(void *tty)
> +ctrlchar_handle_sysrq(struct work_struct *unused)
>  {
> -	handle_sysrq(ctrlchar_sysrq_key, (struct tty_struct *) tty);
> +	handle_sysrq(ctrlchar_sysrq_key, ctrlchar_sysrq_tty);
>  }
>  
> -static DECLARE_WORK(ctrlchar_work, ctrlchar_handle_sysrq, NULL);
> +static DECLARE_WORK(ctrlchar_work, ctrlchar_handle_sysrq);
>  #endif
>  
>  
> @@ -52,8 +53,8 @@ ctrlchar_handle(const unsigned char *buf
>  #ifdef CONFIG_MAGIC_SYSRQ
>  	/* racy */
>  	if (len == 3 && buf[1] == '-') {
> +		ctrlchar_sysrq_tty = tty;
>  		ctrlchar_sysrq_key = buf[2];
> -		ctrlchar_work.data = tty;
>  		schedule_work(&ctrlchar_work);
>  		return CTRLCHAR_SYSRQ;
>  	}

I don't think it's a real fix.

a) what protects tty from disappearing?
b) why the hell do we need that schedule_work() at all?  handle_sysrq() is
supposed to be safe to use from irq handler; when needed it does arrange for
delayed execution itself.

So how about we simply call handle_sysrq() there and be done with that?
Martin?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux