public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Hanna Linder <hannal@us.ibm.com>
Cc: linux-kernel@vger.kernel.org, mochel@osdl.org
Subject: Re: [RFT/C 2.5.70] Input class hook up to driver model/sysfs
Date: Thu, 29 May 2003 00:30:16 -0700	[thread overview]
Message-ID: <20030529073016.GC5603@kroah.com> (raw)
In-Reply-To: <175110000.1054083891@w-hlinder>

On Tue, May 27, 2003 at 06:04:51PM -0700, Hanna Linder wrote:
> 
> root@w-hlinder2 root]# tree /sys/class/input
> /sys/class/input
> |-- mouse0
> |   `-- dev
> `-- mouse1
>     `-- dev

What happened to /sys/class/input/mice?  It should be present too.

Looks good, Al's point about not just calling kfree() on the kobject is
correct, but you copied my tty code which has the same bug :)

Another minor comment:
> -	devfs_remove("input/event%d", evdev->minor);
> +	input_unregister_class_dev("input/event%d", evdev->minor);
>  	evdev_table[evdev->minor] = NULL;
>  	kfree(evdev);
>  }
> @@ -94,8 +94,10 @@ static int evdev_release(struct inode * 
>  	if (!--list->evdev->open) {
>  		if (list->evdev->exist)
>  			input_close_device(&list->evdev->handle);
> -		else
> +		else{
> +			input_unregister_class_dev("input/event%d", list->evdev->minor);
>  			evdev_free(list->evdev);
> +		}
>  	}
>  
>  	kfree(list);
> @@ -374,6 +376,12 @@ static struct file_operations evdev_fops
>  	.flush =	evdev_flush
>  };
>  
> +static struct input_class_interface intf = {
> +	.name = 	"input/event%d",
> +	.mode = 	S_IFCHR | S_IRUGO | S_IWUSR,
> +	.minor_base = 	EVDEV_MINOR_BASE,
> +};
> +
>  static struct input_handle *evdev_connect(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id)
>  {
>  	struct evdev *evdev;
> @@ -402,8 +410,8 @@ static struct input_handle *evdev_connec
>  
>  	evdev_table[minor] = evdev;
>  
> -	devfs_mk_cdev(MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + minor),
> -			S_IFCHR|S_IRUGO|S_IWUSR, "input/event%d", minor);
> +	intf.minor = minor;
> +	input_register_class_dev(dev, &intf);
>  
>  	return &evdev->handle;
>  }
> @@ -417,8 +425,10 @@ static void evdev_disconnect(struct inpu
>  	if (evdev->open) {
>  		input_close_device(handle);
>  		wake_up_interruptible(&evdev->wait);
> -	} else
> +	} else {
> +		input_unregister_class_dev("input/event%d", evdev->minor);
>  		evdev_free(evdev);
> +	}
>  }

You use "input/event%d" 4 times in the above code.  Any way of just
passing the struct input_class_interface into
input_unregister_class_dev() so that you don't have to specify the name
more than once anywhere?

thanks,

greg k-h

  parent reply	other threads:[~2003-05-29  7:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-28  1:04 [RFT/C 2.5.70] Input class hook up to driver model/sysfs Hanna Linder
2003-05-28 23:11 ` Hanna Linder
2003-05-29  7:30 ` Greg KH [this message]
2003-05-29  9:30 ` Christoph Hellwig
2003-06-05 21:12 ` Pavel Machek
2003-06-05 21:17   ` Greg KH
2003-06-05 22:07     ` Pavel Machek
2003-06-05 22:12       ` Patrick Mochel
2003-06-05 22:45         ` Pavel Machek
2003-06-05 22:56           ` Andrew Morton
2003-06-05 23:41             ` viro
2003-06-06  0:03               ` Hanna Linder
2003-06-05 22:16       ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030529073016.GC5603@kroah.com \
    --to=greg@kroah.com \
    --cc=hannal@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mochel@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox