LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
To: linuxppc-dev@ozlabs.org
Subject: Re: [PATCH] adb: create class devices for each handler
Date: Wed, 20 Sep 2006 10:44:39 -0300	[thread overview]
Message-ID: <20060920134439.GB23803@cathedrallabs.org> (raw)
In-Reply-To: <20060808154535.GB3363@cathedrallabs.org>

> This patch creates a class device for each registered ADB handler
> (currently only adbhid) such as /sys/classes/adb/keyboard0/,
> /sys/classes/adb/mouse0/. This is needed for the next patch, to create
> a sysfs entry to make SYSRQ key configurable on ADB based machines.
any comments on this one?

> Signed-off-by: Aristeu S. Rozanski F. <aris@cathedrallabs.org>
> Acked-by: Michael Hanselmann <linux-kernel@hansmi.ch>
> 
> Index: ppc-2.6/drivers/macintosh/adb.c
> ===================================================================
> --- ppc-2.6.orig/drivers/macintosh/adb.c	2006-08-03 23:51:35.000000000 -0300
> +++ ppc-2.6/drivers/macintosh/adb.c	2006-08-03 23:56:00.000000000 -0300
> @@ -102,11 +102,22 @@
>  static void adbdev_init(void);
>  static int try_handler_change(int, int);
>  
> +static char *adb_device_id_string[] = {
> +	[ADB_DONGLE] = "dongle",
> +	[ADB_KEYBOARD] = "keyboard",
> +	[ADB_MOUSE] = "mouse",
> +	[ADB_TABLET] = "tablet",
> +	[ADB_MODEM] = "modem",
> +	[ADB_MISC] = "misc",
> +};
> +
>  static struct adb_handler {
>  	void (*handler)(unsigned char *, int, struct pt_regs *, int);
>  	int original_address;
>  	int handler_id;
>  	int busy;
> +	char name[16];
> +	struct class_device *device;
>  } adb_handler[16];
>  
>  /*
> @@ -541,6 +552,15 @@
>  			write_lock_irq(&adb_handler_lock);
>  			adb_handler[i].handler = handler;
>  			write_unlock_irq(&adb_handler_lock);
> +
> +			snprintf(adb_handler[i].name,
> +				sizeof(adb_handler[i].name), "%s%i",
> +				adb_device_id_string[default_id], ids->nids);
> +			adb_handler[i].device = class_device_create(
> +							adb_dev_class, NULL,
> +							MKDEV(0, 0), NULL,
> +							adb_handler[i].name);
> +			ids->device[ids->nids] = adb_handler[i].device;
>  			ids->id[ids->nids++] = i;
>  		}
>  	}
> @@ -563,6 +583,7 @@
>  		}
>  		ret = 0;
>  		adb_handler[index].handler = NULL;
> +		class_device_del(adb_handler[index].device);
>  	}
>  	write_unlock_irq(&adb_handler_lock);
>  	up(&adb_handler_sem);
> Index: ppc-2.6/include/linux/adb.h
> ===================================================================
> --- ppc-2.6.orig/include/linux/adb.h	2006-08-03 23:51:35.000000000 -0300
> +++ ppc-2.6/include/linux/adb.h	2006-08-03 23:57:56.000000000 -0300
> @@ -3,6 +3,7 @@
>   */
>  #ifndef __ADB_H
>  #define __ADB_H
> +#include <linux/device.h>
>  
>  /* ADB commands */
>  #define ADB_BUSRESET		0
> @@ -58,6 +59,7 @@
>  struct adb_ids {
>  	int nids;
>  	unsigned char id[16];
> +	struct class_device *device[16];
>  };
>  
>  /* Structure which encapsulates a low-level ADB driver */
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

-- 
Aristeu

      reply	other threads:[~2006-09-20 13:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-08 15:45 [PATCH] adb: create class devices for each handler Aristeu Sergio Rozanski Filho
2006-09-20 13:44 ` Aristeu Sergio Rozanski Filho [this message]

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=20060920134439.GB23803@cathedrallabs.org \
    --to=aris@cathedrallabs.org \
    --cc=linuxppc-dev@ozlabs.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