kernel-doc: drivers/base fixes
Subsystems (29)
PATCH 1/1 kernel-doc: drivers/base fixes
In reply to Greg KH[PATCH] kernel-doc: drivers/base fixes
driver/base: add missing function parameters; eliminate all warnings.
---
commit 75b22ab1ec06a56ab4362a2e512ef6bd1d0f6f0d
tree f829459dbc67240683120abfa1c67a81cc4e4044
parent afe631e665d991c18e3e636b1c2455a891758760
author Randy Dunlap <[email protected]> Sun, 23 Oct 2005 11:59:14 -0700 committer Greg Kroah-Hartman <[email protected]> Thu, 27 Oct 2005 22:48:09 -0700
drivers/base/core.c | 4 ++-- drivers/base/driver.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/base/core.c +2 -2
@@ -407,11 +407,11 @@ static struct device * next_device(struc/** * device_for_each_child - device child iterator. -* @dev: parent struct device. +* @parent: parent struct device. * @data: data for the callback. * @fn: function to be called for each device. * -* Iterate over @dev's child devices, and call @fn for each, +* Iterate over @parent's child devices, and call @fn for each, * passing it @data. * * We check the return of @fn each time. If it returns anything
drivers/base/driver.c +2 -1
@@ -28,6 +28,7 @@ static struct device * next_device(struc/** * driver_for_each_device - Iterator for devices bound to a driver. * @drv: Driver we're iterating. +* @start: Device to begin with * @data: Data to pass to the callback. * @fn: Function to call for each device. *
@@ -57,7 +58,7 @@ EXPORT_SYMBOL_GPL(driver_for_each_device/** * driver_find_device - device iterator for locating a particular device. -* @driver: The device's driver +* @drv: The device's driver * @start: Device to begin with * @data: Data to pass to match function * @match: Callback function to check device
PATCH 1/1 DRIVER MODEL: Get rid of the obsolete tri-level suspend/resume callbacks
[PATCH] DRIVER MODEL: Get rid of the obsolete tri-level suspend/resume callbacks
In PM v1, all devices were called at SUSPEND_DISABLE level. Then all devices were called at SUSPEND_SAVE_STATE level, and finally SUSPEND_POWER_DOWN level. However, with PM v2, to maintain compatibility for platform devices, I arranged for the PM v2 suspend/resume callbacks to call the old PM v1 suspend/resume callbacks three times with each level in order so that existing drivers continued to work.
Since this is obsolete infrastructure which is no longer necessary, we can remove it. Here's an (untested) patch to do exactly that.
---
commit afe631e665d991c18e3e636b1c2455a891758760
tree a5ee0e95290b40a8b35b1a33de7e9da5fb7df534
parent c4438d593e764474d701af6deebbb7df567be40f
author Russell King <[email protected]> Thu, 27 Oct 2005 22:48:09 -0700 committer Greg Kroah-Hartman <[email protected]> Thu, 27 Oct 2005 22:48:09 -0700
Documentation/driver-model/driver.txt | 60 +-------------------------------- arch/arm/common/locomo.c | 10 +----- arch/arm/common/sa1111.c | 11 +----- arch/arm/common/scoop.c | 24 ++++++------- arch/arm/mach-pxa/corgi_ssp.c | 24 ++++++------- arch/arm/mach-sa1100/neponset.c | 28 ++++++--------- drivers/base/platform.c | 20 +++-------- drivers/char/s3c2410-rtc.c | 20 +++++------ drivers/char/sonypi.c | 14 +++----- drivers/char/watchdog/s3c2410_wdt.c | 34 ++++++++----------- drivers/hwmon/hdaps.c | 6 +-- drivers/i2c/busses/i2c-s3c2410.c | 8 ++-- drivers/i2c/i2c-core.c | 4 +- drivers/ieee1394/nodemgr.c | 4 +- drivers/input/keyboard/corgikbd.c | 22 ++++++------ drivers/input/keyboard/spitzkbd.c | 44 ++++++++++++------------ drivers/input/serio/i8042.c | 13 ++----- drivers/input/touchscreen/corgi_ts.c | 38 ++++++++++----------- drivers/media/video/msp3400.c | 8 ++-- drivers/media/video/tda9887.c | 4 +- drivers/media/video/tuner-core.c | 4 +- drivers/mfd/mcp-sa11x0.c | 20 +++++------ drivers/mmc/pxamci.c | 8 ++-- drivers/mmc/wbsd.c | 4 +- drivers/mtd/maps/sa1100-flash.c | 8 ++-- drivers/net/dm9000.c | 8 ++-- drivers/net/irda/sa1100_ir.c | 8 ++-- drivers/net/irda/smsc-ircc2.c | 12 +++---- drivers/net/phy/mdio_bus.c | 20 +++-------- drivers/net/smc91x.c | 8 ++-- drivers/pci/pcie/portdrv_core.c | 4 +- drivers/pcmcia/au1000_generic.c | 21 +----------- drivers/pcmcia/hd64465_ss.c | 20 +---------- drivers/pcmcia/i82365.c | 20 +---------- drivers/pcmcia/m32r_cfc.c | 21 +----------- drivers/pcmcia/m32r_pcc.c | 21 +----------- drivers/pcmcia/omap_cf.c | 18 +--------- drivers/pcmcia/pxa2xx_base.c | 26 ++++---------- drivers/pcmcia/sa1100_generic.c | 20 +---------- drivers/pcmcia/tcic.c | 20 +---------- drivers/pcmcia/vrc4171_card.c | 24 +------------ drivers/serial/8250.c | 10 +----- drivers/serial/imx.c | 8 ++-- drivers/serial/mpc52xx_uart.c | 8 ++-- drivers/serial/pxa.c | 8 ++-- drivers/serial/s3c2410.c | 9 ++--- drivers/serial/sa1100.c | 8 ++-- drivers/serial/vr41xx_siu.c | 10 +----- drivers/usb/gadget/dummy_hcd.c | 22 ++---------- drivers/usb/gadget/omap_udc.c | 9 +---- drivers/usb/gadget/pxa2xx_udc.c | 17 ++++----- drivers/usb/host/isp116x-hcd.c | 14 ++------ drivers/usb/host/ohci-omap.c | 10 +----- drivers/usb/host/ohci-pxa27x.c | 4 +- drivers/usb/host/sl811-hcd.c | 10 +----- drivers/video/backlight/corgi_bl.c | 10 ++---- drivers/video/imxfb.c | 10 ++---- drivers/video/pxafb.c | 10 ++---- drivers/video/s1d13xxxfb.c | 7 +--- drivers/video/s3c2410fb.c | 29 +++++++--------- drivers/video/sa1100fb.c | 10 ++---- drivers/video/w100fb.c | 48 +++++++++++++------------- include/linux/device.h | 17 +-------- sound/arm/pxa2xx-ac97.c | 8 ++-- sound/core/init.c | 14 ++------ sound/pci/ac97/ac97_bus.c | 6 ++- 66 files changed, 330 insertions(+), 697 deletions(-)
Documentation/driver-model/driver.txt +2 -58
@@ -196,67 +196,11 @@ it into a supported low-power state. int (*suspend) (struct device * dev, pm_message_t state, u32 level); -suspend is called to put the device in a low power state. There are -several stages to successfully suspending a device, which is denoted in -the @level parameter. Breaking the suspend transition into several -stages affords the platform flexibility in performing device power -management based on the requirements of the system and the -user-defined policy. - -SUSPEND_NOTIFY notifies the device that a suspend transition is about -to happen. This happens on system power state transitions to verify -that all devices can successfully suspend. - -A driver may choose to fail on this call, which should cause the -entire suspend transition to fail. A driver should fail only if it -knows that the device will not be able to be resumed properly when the -system wakes up again. It could also fail if it somehow determines it -is in the middle of an operation too important to stop. - -SUSPEND_DISABLE tells the device to stop I/O transactions. When it -stops transactions, or what it should do with unfinished transactions -is a policy of the driver. After this call, the driver should not -accept any other I/O requests. - -SUSPEND_SAVE_STATE tells the device to save the context of the -hardware. This includes any bus-specific hardware state and -device-specific hardware state. A pointer to this saved state can be -stored in the device's saved_state field. - -SUSPEND_POWER_DOWN tells the driver to place the device in the low -power state requested. - -Whether suspend is called with a given level is a policy of the -platform. Some levels may be omitted; drivers must not assume the -reception of any level. However, all levels must be called in the -order above; i.e. notification will always come before disabling; -disabling the device will come before suspending the device. - -All calls are made with interrupts enabled, except for the -SUSPEND_POWER_DOWN level. +suspend is called to put the device in a low power state. int (*resume) (struct device * dev, u32 level); -Resume is used to bring a device back from a low power state. Like the -suspend transition, it happens in several stages. - -RESUME_POWER_ON tells the driver to set the power state to the state -before the suspend call (The device could have already been in a low -power state before the suspend call to put in a lower power state). - -RESUME_RESTORE_STATE tells the driver to restore the state saved by -the SUSPEND_SAVE_STATE suspend call. - -RESUME_ENABLE tells the driver to start accepting I/O transactions -again. Depending on driver policy, the device may already have pending -I/O requests. - -RESUME_POWER_ON is called with interrupts disabled. The other resume -levels are called with interrupts enabled. - -As with the various suspend stages, the driver must not assume that -any other resume calls have been or will be made. Each call should be -self-contained and not dependent on any external state. +Resume is used to bring a device back from a low power state. Attributes
arch/arm/common/locomo.c +2 -8
@@ -550,15 +550,12 @@ struct locomo_save_data {u16 LCM_SPIMD ; }; -static int locomo_suspend (struct device *dev,pm_message_t state,u32 level) +static int locomo_suspend (struct device *dev,pm_message_t state) {struct locomo *lchip =dev_get_drvdata (dev);struct locomo_save_data *save;unsigned long flags; -if (level !=SUSPEND_DISABLE ) -return 0 ; - save =kmalloc (sizeof (struct locomo_save_data ),GFP_KERNEL );if (!save)return -ENOMEM ;
@@ -597,16 +594,13 @@ static int locomo_suspend(struct devicereturn 0 ; } -static int locomo_resume (struct device *dev,u32 level) +static int locomo_resume (struct device *dev) {struct locomo *lchip =dev_get_drvdata (dev);struct locomo_save_data *save;unsigned long r;unsigned long flags; -if (level !=RESUME_ENABLE ) -return 0 ; - save = (struct locomo_save_data *) dev->power.saved_state;if (!save)return 0 ;
arch/arm/common/sa1111.c +2 -9
@@ -801,7 +801,7 @@ struct sa1111_save_data {#ifdef CONFIG_PM -static int sa1111_suspend (struct device *dev,pm_message_t state,u32 level) +static int sa1111_suspend (struct device *dev,pm_message_t state) {struct sa1111 *sachip =dev_get_drvdata (dev);struct sa1111_save_data *save;
@@ -809,9 +809,6 @@ static int sa1111_suspend(struct deviceunsigned int val;void __iomem *base; -if (level !=SUSPEND_DISABLE ) -return 0 ; - save =kmalloc (sizeof (struct sa1111_save_data ),GFP_KERNEL );if (!save)return -ENOMEM ;
@@ -856,23 +853,19 @@ static int sa1111_suspend(struct device/* * sa1111_resume - Restore the SA1111 device state. * @dev: device to restore -* @level: resume level * * Restore the general state of the SA1111; clock control and * interrupt controller. Other parts of the SA1111 must be * restored by their respective drivers, and must be called * via LDM after this function. */ -static int sa1111_resume (struct device *dev,u32 level) +static int sa1111_resume (struct device *dev) {struct sa1111 *sachip =dev_get_drvdata (dev);struct sa1111_save_data *save;unsigned long flags, id;void __iomem *base; -if (level !=RESUME_ENABLE ) -return 0 ; - save = (struct sa1111_save_data *)dev->power.saved_state;if (!save)return 0 ;
arch/arm/common/scoop.c +11 -13
@@ -102,26 +102,24 @@ static void check_scoop_reg(struct scoop }#ifdef CONFIG_PM -static int scoop_suspend (struct device *dev,pm_message_t state,uint32_t level) +static int scoop_suspend (struct device *dev,pm_message_t state) { -if (level ==SUSPEND_POWER_DOWN ) { -struct scoop_dev *sdev =dev_get_drvdata (dev); +struct scoop_dev *sdev =dev_get_drvdata (dev); + +check_scoop_reg (sdev); + sdev->scoop_gpwr =SCOOP_REG (sdev->base,SCOOP_GPWR ); +SCOOP_REG (sdev->base,SCOOP_GPWR ) = (sdev->scoop_gpwr & ~sdev->suspend_clr) | sdev->suspend_set; -check_scoop_reg (sdev); - sdev->scoop_gpwr =SCOOP_REG (sdev->base,SCOOP_GPWR ); -SCOOP_REG (sdev->base,SCOOP_GPWR ) = (sdev->scoop_gpwr & ~sdev->suspend_clr) | sdev->suspend_set; - }return 0 ; } -static int scoop_resume (struct device *dev,uint32_t level) +static int scoop_resume (struct device *dev) { -if (level ==RESUME_POWER_ON ) { -struct scoop_dev *sdev =dev_get_drvdata (dev); +struct scoop_dev *sdev =dev_get_drvdata (dev); + +check_scoop_reg (sdev); +SCOOP_REG (sdev->base,SCOOP_GPWR ) = sdev->scoop_gpwr; -check_scoop_reg (sdev); -SCOOP_REG (sdev->base,SCOOP_GPWR ) = sdev->scoop_gpwr; - }return 0 ; }#else
arch/arm/mach-pxa/corgi_ssp.c +11 -13
@@ -222,24 +222,22 @@ static int corgi_ssp_remove(struct devicreturn 0 ; } -static int corgi_ssp_suspend (struct device *dev,pm_message_t state,u32 level) +static int corgi_ssp_suspend (struct device *dev,pm_message_t state) { -if (level ==SUSPEND_POWER_DOWN ) { -ssp_flush (&corgi_ssp_dev); -ssp_save_state (&corgi_ssp_dev,&corgi_ssp_state); - } +ssp_flush (&corgi_ssp_dev); +ssp_save_state (&corgi_ssp_dev,&corgi_ssp_state); +return 0 ; } -static int corgi_ssp_resume (struct device *dev,u32 level) +static int corgi_ssp_resume (struct device *dev) { -if (level ==RESUME_POWER_ON ) { -GPSR (ssp_machinfo->cs_lcdcon) =GPIO_bit (ssp_machinfo->cs_lcdcon);/* High - Disable LCD Control/Timing Gen */ -GPSR (ssp_machinfo->cs_max1111) =GPIO_bit (ssp_machinfo->cs_max1111);/* High - Disable MAX1111*/ -GPSR (ssp_machinfo->cs_ads7846) =GPIO_bit (ssp_machinfo->cs_ads7846);/* High - Disable ADS7846*/ -ssp_restore_state (&corgi_ssp_dev,&corgi_ssp_state); -ssp_enable (&corgi_ssp_dev); - } +GPSR (ssp_machinfo->cs_lcdcon) =GPIO_bit (ssp_machinfo->cs_lcdcon);/* High - Disable LCD Control/Timing Gen */ +GPSR (ssp_machinfo->cs_max1111) =GPIO_bit (ssp_machinfo->cs_max1111);/* High - Disable MAX1111*/ +GPSR (ssp_machinfo->cs_ads7846) =GPIO_bit (ssp_machinfo->cs_ads7846);/* High - Disable ADS7846*/ +ssp_restore_state (&corgi_ssp_dev,&corgi_ssp_state); +ssp_enable (&corgi_ssp_dev); +return 0 ; }
arch/arm/mach-sa1100/neponset.c +11 -17
@@ -178,33 +178,27 @@ static int neponset_probe(struct device/* * LDM power management. */ -static int neponset_suspend (struct device *dev,pm_message_t state,u32 level) +static int neponset_suspend (struct device *dev,pm_message_t state) {/* * Save state. */ -if (level ==SUSPEND_SAVE_STATE || - level ==SUSPEND_DISABLE || - level ==SUSPEND_POWER_DOWN ) { -if (!dev->power.saved_state) - dev->power.saved_state =kmalloc (sizeof (unsigned int ),GFP_KERNEL ); -if (!dev->power.saved_state) -return -ENOMEM ; +if (!dev->power.saved_state) + dev->power.saved_state =kmalloc (sizeof (unsigned int ),GFP_KERNEL ); +if (!dev->power.saved_state) +return -ENOMEM ; - *(unsigned int *)dev->power.saved_state =NCR_0 ; - } + *(unsigned int *)dev->power.saved_state =NCR_0 ;return 0 ; } -static int neponset_resume (struct device *dev,u32 level) +static int neponset_resume (struct device *dev) { -if (level ==RESUME_RESTORE_STATE || level ==RESUME_ENABLE ) { -if (dev->power.saved_state) { -NCR_0 = *(unsigned int *)dev->power.saved_state; -kfree (dev->power.saved_state); - dev->power.saved_state =NULL ; - } +if (dev->power.saved_state) { +NCR_0 = *(unsigned int *)dev->power.saved_state; +kfree (dev->power.saved_state); + dev->power.saved_state =NULL ; }return 0 ;
drivers/base/platform.c +6 -14
@@ -281,13 +281,9 @@ static int platform_suspend(struct devic {int ret =0 ; -if (dev->driver && dev->driver->suspend) { - ret = dev->driver->suspend (dev, state,SUSPEND_DISABLE ); -if (ret ==0 ) - ret = dev->driver->suspend (dev, state,SUSPEND_SAVE_STATE ); -if (ret ==0 ) - ret = dev->driver->suspend (dev, state,SUSPEND_POWER_DOWN ); - } +if (dev->driver && dev->driver->suspend) + ret = dev->driver->suspend (dev, state); +return ret; }
@@ -295,13 +291,9 @@ static int platform_resume(struct device {int ret =0 ; -if (dev->driver && dev->driver->resume) { - ret = dev->driver->resume (dev,RESUME_POWER_ON ); -if (ret ==0 ) - ret = dev->driver->resume (dev,RESUME_RESTORE_STATE ); -if (ret ==0 ) - ret = dev->driver->resume (dev,RESUME_ENABLE ); - } +if (dev->driver && dev->driver->resume) + ret = dev->driver->resume (dev); +return ret; }
drivers/char/s3c2410-rtc.c +9 -11
@@ -519,30 +519,28 @@ static struct timespec s3c2410_rtc_deltastatic int ticnt_save; -static int s3c2410_rtc_suspend (struct device *dev,pm_message_t state,u32 level) +static int s3c2410_rtc_suspend (struct device *dev,pm_message_t state) {struct rtc_time tm;struct timespec time; time.tv_nsec =0 ; -if (level ==SUSPEND_POWER_DOWN ) { -/* save TICNT for anyone using periodic interrupts */ +/* save TICNT for anyone using periodic interrupts */ - ticnt_save =readb (S3C2410_TICNT ); + ticnt_save =readb (S3C2410_TICNT ); -/* calculate time delta for suspend */ +/* calculate time delta for suspend */ -s3c2410_rtc_gettime (&tm); -rtc_tm_to_time (&tm, &time.tv_sec); -save_time_delta (&s3c2410_rtc_delta, &time); -s3c2410_rtc_enable (dev,0 ); - } +s3c2410_rtc_gettime (&tm); +rtc_tm_to_time (&tm, &time.tv_sec); +save_time_delta (&s3c2410_rtc_delta, &time); +s3c2410_rtc_enable (dev,0 );return 0 ; } -static int s3c2410_rtc_resume (struct device *dev,u32 level) +static int s3c2410_rtc_resume (struct device *dev) {struct rtc_time tm;struct timespec time;
drivers/char/sonypi.c +6 -8
@@ -1167,19 +1167,17 @@ static int sonypi_disable(void)#ifdef CONFIG_PM static int old_camera_power; -static int sonypi_suspend (struct device *dev,pm_message_t state,u32 level) +static int sonypi_suspend (struct device *dev,pm_message_t state) { -if (level ==SUSPEND_DISABLE ) { - old_camera_power = sonypi_device.camera_power; -sonypi_disable (); - } + old_camera_power = sonypi_device.camera_power; +sonypi_disable (); +return 0 ; } -static int sonypi_resume (struct device *dev,u32 level) +static int sonypi_resume (struct device *dev) { -if (level ==RESUME_ENABLE ) -sonypi_enable (old_camera_power); +sonypi_enable (old_camera_power);return 0 ; }#endif
drivers/char/watchdog/s3c2410_wdt.c +15 -19
@@ -464,32 +464,28 @@ static void s3c2410wdt_shutdown(struct dstatic unsigned long wtcon_save;static unsigned long wtdat_save; -static int s3c2410wdt_suspend (struct device *dev,pm_message_t state,u32 level) +static int s3c2410wdt_suspend (struct device *dev,pm_message_t state) { -if (level ==SUSPEND_POWER_DOWN ) { -/* Save watchdog state, and turn it off. */ - wtcon_save =readl (wdt_base +S3C2410_WTCON ); - wtdat_save =readl (wdt_base +S3C2410_WTDAT ); - -/* Note that WTCNT doesn't need to be saved. */ -s3c2410wdt_stop (); - } +/* Save watchdog state, and turn it off. */ + wtcon_save =readl (wdt_base +S3C2410_WTCON ); + wtdat_save =readl (wdt_base +S3C2410_WTDAT ); + +/* Note that WTCNT doesn't need to be saved. */ +s3c2410wdt_stop ();return 0 ; } -static int s3c2410wdt_resume (struct device *dev,u32 level) +static int s3c2410wdt_resume (struct device *dev) { -if (level ==RESUME_POWER_ON ) { -/* Restore watchdog state. */ +/* Restore watchdog state. */ + +writel (wtdat_save, wdt_base +S3C2410_WTDAT ); +writel (wtdat_save, wdt_base +S3C2410_WTCNT );/* Reset count */ +writel (wtcon_save, wdt_base +S3C2410_WTCON ); -writel (wtdat_save, wdt_base +S3C2410_WTDAT ); -writel (wtdat_save, wdt_base +S3C2410_WTCNT );/* Reset count */ -writel (wtcon_save, wdt_base +S3C2410_WTCON ); - - printk(KERN_INFO PFX "watchdog %sabled\n", - (wtcon_save & S3C2410_WTCON_ENABLE) ? "en" : "dis"); - } + printk(KERN_INFO PFX "watchdog %sabled\n", + (wtcon_save & S3C2410_WTCON_ENABLE) ? "en" : "dis");return 0 ; }
drivers/hwmon/hdaps.c +2 -4
@@ -296,11 +296,9 @@ static int hdaps_probe(struct device *dereturn 0 ; } -static int hdaps_resume (struct device *dev,u32 level) +static int hdaps_resume (struct device *dev) { -if (level ==RESUME_ENABLE ) -return hdaps_device_init (); -return 0 ; +return hdaps_device_init (); }static struct device_driver hdaps_driver = {
drivers/i2c/busses/i2c-s3c2410.c +3 -5
@@ -879,14 +879,12 @@ static int s3c24xx_i2c_remove(struct dev }#ifdef CONFIG_PM -static int s3c24xx_i2c_resume (struct device *dev,u32 level) +static int s3c24xx_i2c_resume (struct device *dev) {struct s3c24xx_i2c *i2c =dev_get_drvdata (dev); - -if (i2c !=NULL && level ==RESUME_ENABLE ) { -dev_dbg (dev,"resume: level %d\n" , level); + +if (i2c !=NULL )s3c24xx_i2c_init (i2c); - }return 0 ; }
drivers/i2c/i2c-core.c +2 -2
@@ -48,7 +48,7 @@ static int i2c_bus_suspend(struct deviceint rc =0 ;if (dev->driver && dev->driver->suspend) - rc = dev->driver->suspend (dev,state,0 ); + rc = dev->driver->suspend (dev, state);return rc; }
@@ -57,7 +57,7 @@ static int i2c_bus_resume(struct deviceint rc =0 ;if (dev->driver && dev->driver->resume) - rc = dev->driver->resume (dev,0 ); + rc = dev->driver->resume (dev);return rc; }
drivers/ieee1394/nodemgr.c +2 -2
@@ -1292,7 +1292,7 @@ static void nodemgr_suspend_ne(struct noif (ud->device.driver && (!ud->device.driver->suspend || - ud->device.driver->suspend (&ud->device,PMSG_SUSPEND ,0 ))) + ud->device.driver->suspend (&ud->device,PMSG_SUSPEND )))device_release_driver (&ud->device); }up_write (&ne->device.bus->subsys.rwsem);
@@ -1315,7 +1315,7 @@ static void nodemgr_resume_ne(struct nodcontinue ;if (ud->device.driver && ud->device.driver->resume) - ud->device.driver->resume (&ud->device,0 ); + ud->device.driver->resume (&ud->device); }up_read (&ne->device.bus->subsys.rwsem);
drivers/input/keyboard/corgikbd.c +10 -12
@@ -259,24 +259,22 @@ static void corgikbd_hinge_timer(unsigne }#ifdef CONFIG_PM -static int corgikbd_suspend (struct device *dev,pm_message_t state,uint32_t level) +static int corgikbd_suspend (struct device *dev,pm_message_t state) { -if (level ==SUSPEND_POWER_DOWN ) { -struct corgikbd *corgikbd =dev_get_drvdata (dev); - corgikbd->suspended =1 ; - } +struct corgikbd *corgikbd =dev_get_drvdata (dev); + corgikbd->suspended =1 ; +return 0 ; } -static int corgikbd_resume (struct device *dev,uint32_t level) +static int corgikbd_resume (struct device *dev) { -if (level ==RESUME_POWER_ON ) { -struct corgikbd *corgikbd =dev_get_drvdata (dev); +struct corgikbd *corgikbd =dev_get_drvdata (dev); + +/* Upon resume, ignore the suspend key for a short while */ + corgikbd->suspend_jiffies=jiffies; + corgikbd->suspended =0 ; -/* Upon resume, ignore the suspend key for a short while */ - corgikbd->suspend_jiffies=jiffies; - corgikbd->suspended =0 ; - }return 0 ; }#else
drivers/input/keyboard/spitzkbd.c +21 -23
55 lines not on this page · raw message
drivers/input/serio/i8042.c +4 -9
@@ -911,12 +911,10 @@ static long i8042_panic_blink(long count* Here we try to restore the original BIOS settings */ -static int i8042_suspend (struct device *dev,pm_message_t state,u32 level) +static int i8042_suspend (struct device *dev,pm_message_t state) { -if (level ==SUSPEND_DISABLE ) { -del_timer_sync (&i8042_timer); -i8042_controller_reset (); - } +del_timer_sync (&i8042_timer); +i8042_controller_reset ();return 0 ; }
@@ -926,13 +924,10 @@ static int i8042_suspend(struct device ** Here we try to reset everything back to a state in which suspended */ -static int i8042_resume (struct device *dev,u32 level) +static int i8042_resume (struct device *dev) {int i; -if (level !=RESUME_ENABLE ) -return 0 ; -if (i8042_ctl_test ())return -1 ;
drivers/input/touchscreen/corgi_ts.c +18 -20
@@ -231,34 +231,32 @@ static irqreturn_t ts_interrupt(int irq, }#ifdef CONFIG_PM -static int corgits_suspend (struct device *dev,pm_message_t state,uint32_t level) +static int corgits_suspend (struct device *dev,pm_message_t state) { -if (level ==SUSPEND_POWER_DOWN ) { -struct corgi_ts *corgi_ts =dev_get_drvdata (dev); - -if (corgi_ts->pendown) { -del_timer_sync (&corgi_ts->timer); - corgi_ts->tc.pressure =0 ; -new_data (corgi_ts,NULL ); - corgi_ts->pendown =0 ; - } - corgi_ts->power_mode =PWR_MODE_SUSPEND ; +struct corgi_ts *corgi_ts =dev_get_drvdata (dev); -corgi_ssp_ads7846_putget ((1u <<ADSCTRL_ADR_SH ) |ADSCTRL_STS ); +if (corgi_ts->pendown) { +del_timer_sync (&corgi_ts->timer); + corgi_ts->tc.pressure =0 ; +new_data (corgi_ts,NULL ); + corgi_ts->pendown =0 ; } + corgi_ts->power_mode =PWR_MODE_SUSPEND ; + +corgi_ssp_ads7846_putget ((1u <<ADSCTRL_ADR_SH ) |ADSCTRL_STS ); +return 0 ; } -static int corgits_resume (struct device *dev,uint32_t level) +static int corgits_resume (struct device *dev) { -if (level ==RESUME_POWER_ON ) { -struct corgi_ts *corgi_ts =dev_get_drvdata (dev); +struct corgi_ts *corgi_ts =dev_get_drvdata (dev); + +corgi_ssp_ads7846_putget ((4u <<ADSCTRL_ADR_SH ) |ADSCTRL_STS ); +/* Enable Falling Edge */ +set_irq_type (corgi_ts->irq_gpio,IRQT_FALLING ); + corgi_ts->power_mode =PWR_MODE_ACTIVE ; -corgi_ssp_ads7846_putget ((4u <<ADSCTRL_ADR_SH ) |ADSCTRL_STS ); -/* Enable Falling Edge */ -set_irq_type (corgi_ts->irq_gpio,IRQT_FALLING ); - corgi_ts->power_mode =PWR_MODE_ACTIVE ; - }return 0 ; }#else
drivers/media/video/msp3400.c +4 -4
@@ -1420,8 +1420,8 @@ static int msp_detach(struct i2c_clientstatic int msp_probe (struct i2c_adapter *adap);static int msp_command (struct i2c_client *client,unsigned int cmd,void *arg); -static int msp_suspend (struct device * dev,pm_message_t state,u32 level); -static int msp_resume (struct device * dev,u32 level); +static int msp_suspend (struct device * dev,pm_message_t state); +static int msp_resume (struct device * dev);static void msp_wake_thread (struct i2c_client *client);
@@ -1821,7 +1821,7 @@ static int msp_command(struct i2c_clientreturn 0 ; } -static int msp_suspend (struct device * dev,pm_message_t state,u32 level) +static int msp_suspend (struct device * dev,pm_message_t state) { struct i2c_client *c = container_of(dev, struct i2c_client, dev);
@@ -1830,7 +1830,7 @@ static int msp_suspend(struct device * dreturn 0 ; } -static int msp_resume (struct device * dev,u32 level) +static int msp_resume (struct device * dev) { struct i2c_client *c = container_of(dev, struct i2c_client, dev);
drivers/media/video/tda9887.c +2 -2
@@ -784,13 +784,13 @@ tda9887_command(struct i2c_client *clienreturn 0 ; } -static int tda9887_suspend (struct device * dev,pm_message_t state,u32 level) +static int tda9887_suspend (struct device * dev,pm_message_t state) {dprintk ("tda9887: suspend\n" );return 0 ; } -static int tda9887_resume (struct device * dev,u32 level) +static int tda9887_resume (struct device * dev) { struct i2c_client *c = container_of(dev, struct i2c_client, dev);struct tda9887 *t =i2c_get_clientdata (c);
drivers/media/video/tuner-core.c +2 -2
@@ -697,7 +697,7 @@ static int tuner_command(struct i2c_cliereturn 0 ; } -static int tuner_suspend (struct device *dev,pm_message_t state,u32 level) +static int tuner_suspend (struct device *dev,pm_message_t state) { struct i2c_client *c = container_of (dev, struct i2c_client, dev);struct tuner *t =i2c_get_clientdata (c);
@@ -707,7 +707,7 @@ static int tuner_suspend(struct device *return 0 ; } -static int tuner_resume (struct device *dev,u32 level) +static int tuner_resume (struct device *dev) { struct i2c_client *c = container_of (dev, struct i2c_client, dev);struct tuner *t =i2c_get_clientdata (c);
drivers/mfd/mcp-sa11x0.c +9 -11
@@ -219,26 +219,24 @@ static int mcp_sa11x0_remove(struct devireturn 0 ; } -static int mcp_sa11x0_suspend (struct device *dev,pm_message_t state,u32 level) +static int mcp_sa11x0_suspend (struct device *dev,pm_message_t state) {struct mcp *mcp =dev_get_drvdata (dev); -if (level ==SUSPEND_DISABLE ) { -priv (mcp)->mccr0 = Ser4MCCR0; -priv (mcp)->mccr1 = Ser4MCCR1; - Ser4MCCR0 &= ~MCCR0_MCE ; - } +priv (mcp)->mccr0 = Ser4MCCR0; +priv (mcp)->mccr1 = Ser4MCCR1; + Ser4MCCR0 &= ~MCCR0_MCE ; +return 0 ; } -static int mcp_sa11x0_resume (struct device *dev,u32 level) +static int mcp_sa11x0_resume (struct device *dev) {struct mcp *mcp =dev_get_drvdata (dev); -if (level ==RESUME_RESTORE_STATE ) { - Ser4MCCR1 =priv (mcp)->mccr1; - Ser4MCCR0 =priv (mcp)->mccr0; - } + Ser4MCCR1 =priv (mcp)->mccr1; + Ser4MCCR0 =priv (mcp)->mccr0; +return 0 ; }
drivers/mmc/pxamci.c +4 -4
@@ -571,23 +571,23 @@ static int pxamci_remove(struct device * }#ifdef CONFIG_PM -static int pxamci_suspend (struct device *dev,pm_message_t state,u32 level) +static int pxamci_suspend (struct device *dev,pm_message_t state) {struct mmc_host *mmc =dev_get_drvdata (dev);int ret =0 ; -if (mmc && level ==SUSPEND_DISABLE ) +if (mmc) ret =mmc_suspend_host (mmc, state);return ret; } -static int pxamci_resume (struct device *dev,u32 level) +static int pxamci_resume (struct device *dev) {struct mmc_host *mmc =dev_get_drvdata (dev);int ret =0 ; -if (mmc && level ==RESUME_ENABLE ) +if (mmc) ret =mmc_resume_host (mmc);return ret;
drivers/mmc/wbsd.c +2 -2
@@ -1955,14 +1955,14 @@ static void __devexit wbsd_pnp_remove(st*/ #ifdef CONFIG_PM -static int wbsd_suspend (struct device *dev,pm_message_t state,u32 level) +static int wbsd_suspend (struct device *dev,pm_message_t state) {DBGF ("Not yet supported\n" );return 0 ; } -static int wbsd_resume (struct device *dev,u32 level) +static int wbsd_resume (struct device *dev) {DBGF ("Not yet supported\n" );
drivers/mtd/maps/sa1100-flash.c +4 -4
@@ -402,21 +402,21 @@ static int __exit sa1100_mtd_remove(stru }#ifdef CONFIG_PM -static int sa1100_mtd_suspend (struct device *dev,pm_message_t state,u32 level) +static int sa1100_mtd_suspend (struct device *dev,pm_message_t state) {struct sa_info *info =dev_get_drvdata (dev);int ret =0 ; -if (info && level ==SUSPEND_SAVE_STATE ) +if (info) ret = info->mtd->suspend (info->mtd);return ret; } -static int sa1100_mtd_resume (struct device *dev,u32 level) +static int sa1100_mtd_resume (struct device *dev) {struct sa_info *info =dev_get_drvdata (dev); -if (info && level ==RESUME_RESTORE_STATE ) +if (info) info->mtd->resume (info->mtd);return 0 ; }
drivers/net/dm9000.c +4 -4
@@ -1140,11 +1140,11 @@ dm9000_phy_write(struct net_device *dev, }static int -dm9000_drv_suspend (struct device *dev,pm_message_t state,u32 level) +dm9000_drv_suspend (struct device *dev,pm_message_t state) {struct net_device *ndev =dev_get_drvdata (dev); -if (ndev && level ==SUSPEND_DISABLE ) { +if (ndev) {if (netif_running (ndev)) {netif_device_detach (ndev);dm9000_shutdown (ndev);
@@ -1154,12 +1154,12 @@ dm9000_drv_suspend(struct device *dev, p }static int -dm9000_drv_resume (struct device *dev,u32 level) +dm9000_drv_resume (struct device *dev) {struct net_device *ndev =dev_get_drvdata (dev);board_info_t *db = (board_info_t *) ndev->priv; -if (ndev && level ==RESUME_ENABLE ) { +if (ndev) {if (netif_running (ndev)) {dm9000_reset (db);
drivers/net/irda/sa1100_ir.c +4 -4
@@ -291,12 +291,12 @@ static void sa1100_irda_shutdown(struct/* * Suspend the IrDA interface. */ -static int sa1100_irda_suspend (struct device *_dev,pm_message_t state,u32 level) +static int sa1100_irda_suspend (struct device *_dev,pm_message_t state) {struct net_device *dev =dev_get_drvdata (_dev);struct sa1100_irda *si; -if (!dev || level !=SUSPEND_DISABLE ) +if (!dev)return 0 ; si = dev->priv;
@@ -316,12 +316,12 @@ static int sa1100_irda_suspend(struct de/* * Resume the IrDA interface. */ -static int sa1100_irda_resume (struct device *_dev,u32 level) +static int sa1100_irda_resume (struct device *_dev) {struct net_device *dev =dev_get_drvdata (_dev);struct sa1100_irda *si; -if (!dev || level !=RESUME_ENABLE ) +if (!dev)return 0 ; si = dev->priv;
drivers/net/irda/smsc-ircc2.c +6 -6
@@ -213,8 +213,8 @@ static int smsc_ircc_probe_transceiver_/* Power Management */ -static int smsc_ircc_suspend (struct device *dev,pm_message_t state,u32 level); -static int smsc_ircc_resume (struct device *dev,u32 level); +static int smsc_ircc_suspend (struct device *dev,pm_message_t state); +static int smsc_ircc_resume (struct device *dev);static struct device_driver smsc_ircc_driver = { .name =SMSC_IRCC2_DRIVER_NAME ,
@@ -1646,13 +1646,13 @@ static int smsc_ircc_net_close(struct nereturn 0 ; } -static int smsc_ircc_suspend (struct device *dev,pm_message_t state,u32 level) +static int smsc_ircc_suspend (struct device *dev,pm_message_t state) {struct smsc_ircc_cb *self =dev_get_drvdata (dev);IRDA_MESSAGE ("%s, Suspending\n" , driver_name); -if (level ==SUSPEND_DISABLE && !self->io.suspended) { +if (!self->io.suspended) {smsc_ircc_net_close (self->netdev); self->io.suspended =1 ; }
@@ -1660,11 +1660,11 @@ static int smsc_ircc_suspend(struct devireturn 0 ; } -static int smsc_ircc_resume (struct device *dev,u32 level) +static int smsc_ircc_resume (struct device *dev) {struct smsc_ircc_cb *self =dev_get_drvdata (dev); -if (level ==RESUME_ENABLE && self->io.suspended) { +if (self->io.suspended) {smsc_ircc_net_open (self->netdev); self->io.suspended =0 ;
drivers/net/phy/mdio_bus.c +6 -14
@@ -133,13 +133,9 @@ static int mdio_bus_suspend(struct devicint ret =0 ;struct device_driver *drv = dev->driver; -if (drv && drv->suspend) { - ret = drv->suspend (dev, state,SUSPEND_DISABLE ); -if (ret ==0 ) - ret = drv->suspend (dev, state,SUSPEND_SAVE_STATE ); -if (ret ==0 ) - ret = drv->suspend (dev, state,SUSPEND_POWER_DOWN ); - } +if (drv && drv->suspend) + ret = drv->suspend (dev, state); +return ret; }
@@ -148,13 +144,9 @@ static int mdio_bus_resume(struct deviceint ret =0 ;struct device_driver *drv = dev->driver; -if (drv && drv->resume) { - ret = drv->resume (dev,RESUME_POWER_ON ); -if (ret ==0 ) - ret = drv->resume (dev,RESUME_RESTORE_STATE ); -if (ret ==0 ) - ret = drv->resume (dev,RESUME_ENABLE ); - } +if (drv && drv->resume) + ret = drv->resume (dev); +return ret; }
drivers/net/smc91x.c +4 -4
@@ -2291,11 +2291,11 @@ static int smc_drv_remove(struct devicereturn 0 ; } -static int smc_drv_suspend (struct device *dev,pm_message_t state,u32 level) +static int smc_drv_suspend (struct device *dev,pm_message_t state) {struct net_device *ndev =dev_get_drvdata (dev); -if (ndev && level ==SUSPEND_DISABLE ) { +if (ndev) {if (netif_running (ndev)) {netif_device_detach (ndev);smc_shutdown (ndev);
@@ -2305,12 +2305,12 @@ static int smc_drv_suspend(struct devicereturn 0 ; } -static int smc_drv_resume (struct device *dev,u32 level) +static int smc_drv_resume (struct device *dev) {struct platform_device *pdev =to_platform_device (dev);struct net_device *ndev =dev_get_drvdata (dev); -if (ndev && level ==RESUME_ENABLE ) { +if (ndev) {struct smc_local *lp =netdev_priv (ndev);smc_enable_device (pdev);if (netif_running (ndev)) {
drivers/pci/pcie/portdrv_core.c +2 -2
@@ -61,7 +61,7 @@ static int pcie_port_remove_service(strustatic void pcie_port_shutdown_service (struct device *dev) {} -static int pcie_port_suspend_service (struct device *dev,pm_message_t state,u32 level) +static int pcie_port_suspend_service (struct device *dev,pm_message_t state) {struct pcie_device *pciedev;struct pcie_port_service_driver *driver;
@@ -76,7 +76,7 @@ static int pcie_port_suspend_service(strreturn 0 ; } -static int pcie_port_resume_service (struct device *dev,u32 level) +static int pcie_port_resume_service (struct device *dev) {struct pcie_device *pciedev;struct pcie_port_service_driver *driver;
drivers/pcmcia/au1000_generic.c +2 -19
@@ -519,30 +519,13 @@ static int au1x00_drv_pcmcia_probe(struc } -static int au1x00_drv_pcmcia_suspend (struct device *dev,pm_message_t state,u32 level) -{ -int ret =0 ; -if (level ==SUSPEND_SAVE_STATE ) - ret =pcmcia_socket_dev_suspend (dev, state); -return ret; -} - -static int au1x00_drv_pcmcia_resume (struct device *dev,u32 level) -{ -int ret =0 ; -if (level ==RESUME_RESTORE_STATE ) - ret =pcmcia_socket_dev_resume (dev); -return ret; -} - -static struct device_driver au1x00_pcmcia_driver = { .probe = au1x00_drv_pcmcia_probe, .remove = au1x00_drv_pcmcia_remove, .name ="au1x00-pcmcia" , .bus = &platform_bus_type, - .suspend = au1x00_drv_pcmcia_suspend, - .resume = au1x00_drv_pcmcia_resume + .suspend = pcmcia_socket_dev_suspend, + .resume = pcmcia_socket_dev_resume, };static struct platform_device au1x00_device = {
drivers/pcmcia/hd64465_ss.c +2 -18
@@ -844,27 +844,11 @@ static void hs_exit_socket(hs_socket_t *local_irq_restore (flags); } -static int hd64465_suspend (struct device *dev,pm_message_t state,u32 level) -{ -int ret =0 ; -if (level ==SUSPEND_SAVE_STATE ) - ret =pcmcia_socket_dev_suspend (dev, state); -return ret; -} - -static int hd64465_resume (struct device *dev,u32 level) -{ -int ret =0 ; -if (level ==RESUME_RESTORE_STATE ) - ret =pcmcia_socket_dev_resume (dev); -return ret; -} -static struct device_driver hd64465_driver = { .name ="hd64465-pcmcia" , .bus = &platform_bus_type, - .suspend = hd64465_suspend, - .resume = hd64465_resume, + .suspend = pcmcia_socket_dev_suspend, + .resume = pcmcia_socket_dev_resume, };static struct platform_device hd64465_device = {
drivers/pcmcia/i82365.c +2 -18
@@ -1332,27 +1332,11 @@ static struct pccard_operations pcic_ope/*====================================================================*/ -static int i82365_suspend (struct device *dev,pm_message_t state,u32 level) -{ -int ret =0 ; -if (level ==SUSPEND_SAVE_STATE ) - ret =pcmcia_socket_dev_suspend (dev, state); -return ret; -} - -static int i82365_resume (struct device *dev,u32 level) -{ -int ret =0 ; -if (level ==RESUME_RESTORE_STATE ) - ret =pcmcia_socket_dev_resume (dev); -return ret; -} -static struct device_driver i82365_driver = { .name ="i82365" , .bus = &platform_bus_type, - .suspend = i82365_suspend, - .resume = i82365_resume, + .suspend = pcmcia_socket_dev_suspend, + .resume = pcmcia_socket_dev_resume, };static struct platform_device i82365_device = {
drivers/pcmcia/m32r_cfc.c +2 -19
@@ -731,28 +731,11 @@ static struct pccard_operations pcc_oper/*====================================================================*/ -static int m32r_pcc_suspend (struct device *dev,pm_message_t state,u32 level) -{ -int ret =0 ; -if (level ==SUSPEND_SAVE_STATE ) - ret =pcmcia_socket_dev_suspend (dev, state); -return ret; -} - -static int m32r_pcc_resume (struct device *dev,u32 level) -{ -int ret =0 ; -if (level ==RESUME_RESTORE_STATE ) - ret =pcmcia_socket_dev_resume (dev); -return ret; -} - -static struct device_driver pcc_driver = { .name ="cfc" , .bus = &platform_bus_type, - .suspend = m32r_pcc_suspend, - .resume = m32r_pcc_resume, + .suspend = pcmcia_socket_dev_suspend, + .resume = pcmcia_socket_dev_resume, };static struct platform_device pcc_device = {
drivers/pcmcia/m32r_pcc.c +2 -19
@@ -695,28 +695,11 @@ static struct pccard_operations pcc_oper/*====================================================================*/ -static int m32r_pcc_suspend (struct device *dev,pm_message_t state,u32 level) -{ -int ret =0 ; -if (level ==SUSPEND_SAVE_STATE ) - ret =pcmcia_socket_dev_suspend (dev, state); -return ret; -} - -static int m32r_pcc_resume (struct device *dev,u32 level) -{ -int ret =0 ; -if (level ==RESUME_RESTORE_STATE ) - ret =pcmcia_socket_dev_resume (dev); -return ret; -} - -static struct device_driver pcc_driver = { .name ="pcc" , .bus = &platform_bus_type, - .suspend = m32r_pcc_suspend, - .resume = m32r_pcc_resume, + .suspend = pcmcia_socket_dev_suspend, + .resume = pcmcia_socket_dev_resume, };static struct platform_device pcc_device = {
drivers/pcmcia/omap_cf.c +2 -16
@@ -329,27 +329,13 @@ static int __devexit omap_cf_remove(strureturn 0 ; } -static int omap_cf_suspend (struct device *dev,pm_message_t mesg,u32 level) -{ -if (level !=SUSPEND_SAVE_STATE ) -return 0 ; -return pcmcia_socket_dev_suspend (dev, mesg); -} - -static int omap_cf_resume (struct device *dev,u32 level) -{ -if (level !=RESUME_RESTORE_STATE ) -return 0 ; -return pcmcia_socket_dev_resume (dev); -} -static struct device_driver omap_cf_driver = { .name = (char *) driver_name, .bus = &platform_bus_type, .probe = omap_cf_probe, .remove =__devexit_p (omap_cf_remove), - .suspend = omap_cf_suspend, - .resume = omap_cf_resume, + .suspend = pcmcia_socket_dev_suspend, + .resume = pcmcia_socket_dev_resume, };static int __init omap_cf_init (void )
drivers/pcmcia/pxa2xx_base.c +7 -19
@@ -205,32 +205,20 @@ int pxa2xx_drv_pcmcia_probe(struct devic }EXPORT_SYMBOL (pxa2xx_drv_pcmcia_probe); -static int pxa2xx_drv_pcmcia_suspend (struct device *dev,pm_message_t state,u32 level) +static int pxa2xx_drv_pcmcia_resume (struct device *dev) { -int ret =0 ; -if (level ==SUSPEND_SAVE_STATE ) - ret =pcmcia_socket_dev_suspend (dev, state); -return ret; -} +struct pcmcia_low_level *ops = dev->platform_data; +int nr = ops ? ops->nr :0 ; -static int pxa2xx_drv_pcmcia_resume (struct device *dev,u32 level) -{ -int ret =0 ; -if (level ==RESUME_RESTORE_STATE ) - { -struct pcmcia_low_level *ops = dev->platform_data; -int nr = ops ? ops->nr :0 ; - -MECR = nr >1 ?MECR_CIT |MECR_NOS : (nr >0 ?MECR_CIT :0 ); - ret =pcmcia_socket_dev_resume (dev); - } -return ret; +MECR = nr >1 ?MECR_CIT |MECR_NOS : (nr >0 ?MECR_CIT :0 ); + +return pcmcia_socket_dev_resume (dev); }static struct device_driver pxa2xx_pcmcia_driver = { .probe = pxa2xx_drv_pcmcia_probe, .remove = soc_common_drv_pcmcia_remove, - .suspend = pxa2xx_drv_pcmcia_suspend, + .suspend = pcmcia_socket_dev_suspend, .resume = pxa2xx_drv_pcmcia_resume, .name ="pxa2xx-pcmcia" , .bus = &platform_bus_type,
drivers/pcmcia/sa1100_generic.c +2 -18
@@ -74,29 +74,13 @@ static int sa11x0_drv_pcmcia_probe(strucreturn ret; } -static int sa11x0_drv_pcmcia_suspend (struct device *dev,pm_message_t state,u32 level) -{ -int ret =0 ; -if (level ==SUSPEND_SAVE_STATE ) - ret =pcmcia_socket_dev_suspend (dev, state); -return ret; -} - -static int sa11x0_drv_pcmcia_resume (struct device *dev,u32 level) -{ -int ret =0 ; -if (level ==RESUME_RESTORE_STATE ) - ret =pcmcia_socket_dev_resume (dev); -return ret; -} -static struct device_driver sa11x0_pcmcia_driver = { .probe = sa11x0_drv_pcmcia_probe, .remove = soc_common_drv_pcmcia_remove, .name ="sa11x0-pcmcia" , .bus = &platform_bus_type, - .suspend = sa11x0_drv_pcmcia_suspend, - .resume = sa11x0_drv_pcmcia_resume, + .suspend = pcmcia_socket_dev_suspend, + .resume = pcmcia_socket_dev_resume, };/* sa11x0_pcmcia_init()
drivers/pcmcia/tcic.c +2 -18
@@ -372,27 +372,11 @@ static int __init get_tcic_id(void)/*====================================================================*/ -static int tcic_drv_suspend (struct device *dev,pm_message_t state,u32 level) -{ -int ret =0 ; -if (level ==SUSPEND_SAVE_STATE ) - ret =pcmcia_socket_dev_suspend (dev, state); -return ret; -} - -static int tcic_drv_resume (struct device *dev,u32 level) -{ -int ret =0 ; -if (level ==RESUME_RESTORE_STATE ) - ret =pcmcia_socket_dev_resume (dev); -return ret; -} -static struct device_driver tcic_driver = { .name ="tcic-pcmcia" , .bus = &platform_bus_type, - .suspend = tcic_drv_suspend, - .resume = tcic_drv_resume, + .suspend = pcmcia_socket_dev_suspend, + .resume = pcmcia_socket_dev_resume, };static struct platform_device tcic_device = {
drivers/pcmcia/vrc4171_card.c +2 -22
@@ -774,31 +774,11 @@ static int __devinit vrc4171_card_setup(__setup ("vrc4171_card=" , vrc4171_card_setup); -static int vrc4171_card_suspend (struct device *dev,pm_message_t state,u32 level) -{ -int retval =0 ; - -if (level ==SUSPEND_SAVE_STATE ) - retval =pcmcia_socket_dev_suspend (dev, state); - -return retval; -} - -static int vrc4171_card_resume (struct device *dev,u32 level) -{ -int retval =0 ; - -if (level ==RESUME_RESTORE_STATE ) - retval =pcmcia_socket_dev_resume (dev); - -return retval; -} -static struct device_driver vrc4171_card_driver = { .name = vrc4171_card_name, .bus = &platform_bus_type, - .suspend = vrc4171_card_suspend, - .resume = vrc4171_card_resume, + .suspend = pcmcia_socket_dev_suspend, + .resume = pcmcia_socket_dev_resume, };static int __devinit vrc4171_card_init (void )
drivers/serial/8250.c +2 -8
@@ -2358,13 +2358,10 @@ static int __devexit serial8250_remove(sreturn 0 ; } -static int serial8250_suspend (struct device *dev,pm_message_t state,u32 level) +static int serial8250_suspend (struct device *dev,pm_message_t state) {int i; -if (level !=SUSPEND_DISABLE ) -return 0 ; -for (i =0 ; i <UART_NR ; i++) {struct uart_8250_port *up = &serial8250_ports[i];
@@ -2375,13 +2372,10 @@ static int serial8250_suspend(struct devreturn 0 ; } -static int serial8250_resume (struct device *dev,u32 level) +static int serial8250_resume (struct device *dev) {int i; -if (level !=RESUME_ENABLE ) -return 0 ; -for (i =0 ; i <UART_NR ; i++) {struct uart_8250_port *up = &serial8250_ports[i];
drivers/serial/imx.c +4 -4
@@ -921,21 +921,21 @@ static struct uart_driver imx_reg = { .cons = IMX_CONSOLE, }; -static int serial_imx_suspend (struct device *_dev,pm_message_t state,u32 level) +static int serial_imx_suspend (struct device *_dev,pm_message_t state) {struct imx_port *sport =dev_get_drvdata (_dev); -if (sport && level ==SUSPEND_DISABLE ) +if (sport)uart_suspend_port (&imx_reg, &sport->port);return 0 ; } -static int serial_imx_resume (struct device *_dev,u32 level) +static int serial_imx_resume (struct device *_dev) {struct imx_port *sport =dev_get_drvdata (_dev); -if (sport && level ==RESUME_ENABLE ) +if (sport)uart_resume_port (&imx_reg, &sport->port);return 0 ;
drivers/serial/mpc52xx_uart.c +4 -4
@@ -781,22 +781,22 @@ mpc52xx_uart_remove(struct device *dev)#ifdef CONFIG_PM static int -mpc52xx_uart_suspend (struct device *dev,pm_message_t state,u32 level) +mpc52xx_uart_suspend (struct device *dev,pm_message_t state) {struct uart_port *port = (struct uart_port *)dev_get_drvdata (dev); -if (sport && level ==SUSPEND_DISABLE ) +if (sport)uart_suspend_port (&mpc52xx_uart_driver, port);return 0 ; }static int -mpc52xx_uart_resume (struct device *dev,u32 level) +mpc52xx_uart_resume (struct device *dev) {struct uart_port *port = (struct uart_port *)dev_get_drvdata (dev); -if (port && level ==RESUME_ENABLE ) +if (port)uart_resume_port (&mpc52xx_uart_driver, port);return 0 ;
drivers/serial/pxa.c +4 -4
@@ -786,21 +786,21 @@ static struct uart_driver serial_pxa_reg .cons = PXA_CONSOLE, }; -static int serial_pxa_suspend (struct device *_dev,pm_message_t state,u32 level) +static int serial_pxa_suspend (struct device *_dev,pm_message_t state) {struct uart_pxa_port *sport =dev_get_drvdata (_dev); -if (sport && level ==SUSPEND_DISABLE ) +if (sport)uart_suspend_port (&serial_pxa_reg, &sport->port);return 0 ; } -static int serial_pxa_resume (struct device *_dev,u32 level) +static int serial_pxa_resume (struct device *_dev) {struct uart_pxa_port *sport =dev_get_drvdata (_dev); -if (sport && level ==RESUME_ENABLE ) +if (sport)uart_resume_port (&serial_pxa_reg, &sport->port);return 0 ;
drivers/serial/s3c2410.c +4 -5
@@ -1134,23 +1134,22 @@ static int s3c24xx_serial_remove(struct#ifdef CONFIG_PM -static int s3c24xx_serial_suspend (struct device *dev,pm_message_t state, -u32 level) +static int s3c24xx_serial_suspend (struct device *dev,pm_message_t state) {struct uart_port *port =s3c24xx_dev_to_port (dev); -if (port && level ==SUSPEND_DISABLE ) +if (port)uart_suspend_port (&s3c24xx_uart_drv, port);return 0 ; } -static int s3c24xx_serial_resume (struct device *dev,u32 level) +static int s3c24xx_serial_resume (struct device *dev) {struct uart_port *port =s3c24xx_dev_to_port (dev);struct s3c24xx_uart_port *ourport =to_ourport (port); -if (port && level ==RESUME_ENABLE ) { +if (port) {clk_enable (ourport->clk);s3c24xx_serial_resetport (port,s3c24xx_port_to_cfg (port));clk_disable (ourport->clk);
drivers/serial/sa1100.c +4 -4
@@ -834,21 +834,21 @@ static struct uart_driver sa1100_reg = { .cons = SA1100_CONSOLE, }; -static int sa1100_serial_suspend (struct device *_dev,pm_message_t state,u32 level) +static int sa1100_serial_suspend (struct device *_dev,pm_message_t state) {struct sa1100_port *sport =dev_get_drvdata (_dev); -if (sport && level ==SUSPEND_DISABLE ) +if (sport)uart_suspend_port (&sa1100_reg, &sport->port);return 0 ; } -static int sa1100_serial_resume (struct device *_dev,u32 level) +static int sa1100_serial_resume (struct device *_dev) {struct sa1100_port *sport =dev_get_drvdata (_dev); -if (sport && level ==RESUME_ENABLE ) +if (sport)uart_resume_port (&sa1100_reg, &sport->port);return 0 ;
drivers/serial/vr41xx_siu.c +2 -8
@@ -976,14 +976,11 @@ static int siu_remove(struct device *devreturn 0 ; } -static int siu_suspend (struct device *dev,pm_message_t state,u32 level) +static int siu_suspend (struct device *dev,pm_message_t state) {struct uart_port *port;int i; -if (level !=SUSPEND_DISABLE ) -return 0 ; -for (i =0 ; i < siu_uart_driver.nr; i++) { port = &siu_uart_ports[i]; if ((port->type == PORT_VR41XX_SIU ||
@@ -995,14 +992,11 @@ static int siu_suspend(struct device *dereturn 0 ; } -static int siu_resume (struct device *dev,u32 level) +static int siu_resume (struct device *dev) {struct uart_port *port;int i; -if (level !=RESUME_ENABLE ) -return 0 ; -for (i =0 ; i < siu_uart_driver.nr; i++) { port = &siu_uart_ports[i]; if ((port->type == PORT_VR41XX_SIU ||
drivers/usb/gadget/dummy_hcd.c +4 -18
@@ -935,14 +935,10 @@ static int dummy_udc_remove (struct devireturn 0 ; } -static int dummy_udc_suspend (struct device *dev,pm_message_t state, -u32 level) +static int dummy_udc_suspend (struct device *dev,pm_message_t state) {struct dummy *dum =dev_get_drvdata (dev); -if (level !=SUSPEND_DISABLE ) -return 0 ; -dev_dbg (dev,"%s\n" , __FUNCTION__);spin_lock_irq (&dum->lock); dum->udc_suspended =1 ;
@@ -954,13 +950,10 @@ static int dummy_udc_suspend (struct devreturn 0 ; } -static int dummy_udc_resume (struct device *dev,u32 level) +static int dummy_udc_resume (struct device *dev) {struct dummy *dum =dev_get_drvdata (dev); -if (level !=RESUME_ENABLE ) -return 0 ; -dev_dbg (dev,"%s\n" , __FUNCTION__);spin_lock_irq (&dum->lock); dum->udc_suspended =0 ;
@@ -1936,14 +1929,10 @@ static int dummy_hcd_remove (struct devireturn 0 ; } -static int dummy_hcd_suspend (struct device *dev,pm_message_t state, -u32 level) +static int dummy_hcd_suspend (struct device *dev,pm_message_t state) {struct usb_hcd *hcd; -if (level !=SUSPEND_DISABLE ) -return 0 ; -dev_dbg (dev,"%s\n" , __FUNCTION__); hcd =dev_get_drvdata (dev);
@@ -1958,13 +1947,10 @@ static int dummy_hcd_suspend (struct devreturn 0 ; } -static int dummy_hcd_resume (struct device *dev,u32 level) +static int dummy_hcd_resume (struct device *dev) {struct usb_hcd *hcd; -if (level !=RESUME_ENABLE ) -return 0 ; -dev_dbg (dev,"%s\n" , __FUNCTION__); hcd =dev_get_drvdata (dev); hcd->state =HC_STATE_RUNNING ;
drivers/usb/gadget/omap_udc.c +2 -7
@@ -2909,12 +2909,10 @@ static int __exit omap_udc_remove(struct* may involve talking to an external transceiver (e.g. isp1301). */ -static int omap_udc_suspend (struct device *dev,pm_message_t message,u32 level) +static int omap_udc_suspend (struct device *dev,pm_message_t message) {u32 devstat; -if (level !=SUSPEND_POWER_DOWN ) -return 0 ; devstat =UDC_DEVSTAT_REG ;/* we're requesting 48 MHz clock if the pullup is enabled
@@ -2931,11 +2929,8 @@ static int omap_udc_suspend(struct devicreturn 0 ; } -static int omap_udc_resume (struct device *dev,u32 level) +static int omap_udc_resume (struct device *dev) { -if (level !=RESUME_POWER_ON ) -return 0 ; -DBG ("resume + wakeup/SRP\n" );omap_pullup (&udc->gadget,1 );
drivers/usb/gadget/pxa2xx_udc.c +8 -9
@@ -2602,24 +2602,23 @@ static int __exit pxa2xx_udc_remove(stru* VBUS IRQs should probably be ignored so that the PXA device just acts * "dead" to USB hosts until system resume. */ -static int pxa2xx_udc_suspend (struct device *dev,pm_message_t state,u32 level) +static int pxa2xx_udc_suspend (struct device *dev,pm_message_t state) {struct pxa2xx_udc *udc =dev_get_drvdata (dev); -if (level ==SUSPEND_POWER_DOWN ) { -if (!udc->mach->udc_command) -WARN ("USB host won't detect disconnect!\n" ); -pullup (udc,0 ); - } +if (!udc->mach->udc_command) +WARN ("USB host won't detect disconnect!\n" ); +pullup (udc,0 ); +return 0 ; } -static int pxa2xx_udc_resume (struct device *dev,u32 level) +static int pxa2xx_udc_resume (struct device *dev) {struct pxa2xx_udc *udc =dev_get_drvdata (dev); -if (level ==RESUME_POWER_ON ) -pullup (udc,1 ); +pullup (udc,1 ); +return 0 ; }
drivers/usb/host/isp116x-hcd.c +4 -10
@@ -1774,15 +1774,12 @@ static int __init isp116x_probe(struct d/* Suspend of platform device */ -static int isp116x_suspend (struct device *dev,pm_message_t state,u32 phase) +static int isp116x_suspend (struct device *dev,pm_message_t state) {int ret =0 ;struct usb_hcd *hcd =dev_get_drvdata (dev); -VDBG ("%s: state %x, phase %x\n" , __func__, state, phase); - -if (phase !=SUSPEND_DISABLE && phase !=SUSPEND_POWER_DOWN ) -return 0 ; +VDBG ("%s: state %x\n" , __func__, state); ret =usb_suspend_device (hcd->self.root_hub, state);if (!ret) {
@@ -1797,15 +1794,12 @@ static int isp116x_suspend(struct device/* Resume platform device */ -static int isp116x_resume (struct device *dev,u32 phase) +static int isp116x_resume (struct device *dev) {int ret =0 ;struct usb_hcd *hcd =dev_get_drvdata (dev); -VDBG ("%s: state %x, phase %x\n" , __func__, dev->power.power_state, - phase); -if (phase !=RESUME_POWER_ON ) -return 0 ; +VDBG ("%s: state %x\n" , __func__, dev->power.power_state); ret =usb_resume_device (hcd->self.root_hub);if (!ret) {
drivers/usb/host/ohci-omap.c +2 -8
@@ -455,14 +455,11 @@ static int ohci_hcd_omap_drv_remove(stru#ifdef CONFIG_PM -static int ohci_omap_suspend (struct device *dev,pm_message_t message,u32 level) +static int ohci_omap_suspend (struct device *dev,pm_message_t message) {struct ohci_hcd *ohci =hcd_to_ohci (dev_get_drvdata (dev));int status = -EINVAL ; -if (level !=SUSPEND_POWER_DOWN ) -return 0 ; -down (&ohci_to_hcd (ohci)->self.root_hub->serialize); status =ohci_hub_suspend (ohci_to_hcd (ohci));if (status ==0 ) {
@@ -476,14 +473,11 @@ static int ohci_omap_suspend(struct devireturn status; } -static int ohci_omap_resume (struct device *dev,u32 level) +static int ohci_omap_resume (struct device *dev) {struct ohci_hcd *ohci =hcd_to_ohci (dev_get_drvdata (dev));int status =0 ; -if (level !=RESUME_POWER_ON ) -return 0 ; -if (time_before (jiffies, ohci->next_statechange))msleep (5 ); ohci->next_statechange = jiffies;
drivers/usb/host/ohci-pxa27x.c +2 -2
@@ -309,7 +309,7 @@ static int ohci_hcd_pxa27x_drv_remove(streturn 0 ; } -static int ohci_hcd_pxa27x_drv_suspend (struct device *dev,pm_message_t state,u32 level) +static int ohci_hcd_pxa27x_drv_suspend (struct device *dev,pm_message_t state) {// struct platform_device *pdev = to_platform_device(dev); // struct usb_hcd *hcd = dev_get_drvdata(dev);
@@ -318,7 +318,7 @@ static int ohci_hcd_pxa27x_drv_suspend(sreturn 0 ; } -static int ohci_hcd_pxa27x_drv_resume (struct device *dev,u32 level) +static int ohci_hcd_pxa27x_drv_resume (struct device *dev) {// struct platform_device *pdev = to_platform_device(dev); // struct usb_hcd *hcd = dev_get_drvdata(dev);
drivers/usb/host/sl811-hcd.c +2 -8
@@ -1784,15 +1784,12 @@ sl811h_probe(struct device *dev)*/ static int -sl811h_suspend (struct device *dev,pm_message_t state,u32 phase) +sl811h_suspend (struct device *dev,pm_message_t state) {struct usb_hcd *hcd =dev_get_drvdata (dev);struct sl811 *sl811 =hcd_to_sl811 (hcd);int retval =0 ; -if (phase !=SUSPEND_POWER_DOWN ) -return retval; -if (state.event ==PM_EVENT_FREEZE ) retval =sl811h_hub_suspend (hcd);else if (state.event ==PM_EVENT_SUSPEND )
@@ -1803,14 +1800,11 @@ sl811h_suspend(struct device *dev, pm_me }static int -sl811h_resume (struct device *dev,u32 phase) +sl811h_resume (struct device *dev) {struct usb_hcd *hcd =dev_get_drvdata (dev);struct sl811 *sl811 =hcd_to_sl811 (hcd); -if (phase !=RESUME_POWER_ON ) -return 0 ; -/* with no "check to see if VBUS is still powered" board hook, * let's assume it'd only be powered to enable remote wakeup. */
drivers/video/backlight/corgi_bl.c +4 -6
@@ -73,17 +73,15 @@ static void corgibl_blank(int blank) }#ifdef CONFIG_PM -static int corgibl_suspend (struct device *dev,pm_message_t state,u32 level) +static int corgibl_suspend (struct device *dev,pm_message_t state) { -if (level ==SUSPEND_POWER_DOWN ) -corgibl_blank (FB_BLANK_POWERDOWN ); +corgibl_blank (FB_BLANK_POWERDOWN );return 0 ; } -static int corgibl_resume (struct device *dev,u32 level) +static int corgibl_resume (struct device *dev) { -if (level ==RESUME_POWER_ON ) -corgibl_blank (FB_BLANK_UNBLANK ); +corgibl_blank (FB_BLANK_UNBLANK );return 0 ; }#else
drivers/video/imxfb.c +4 -6
@@ -424,23 +424,21 @@ static void imxfb_setup_gpio(struct imxf* Power management hooks. Note that we won't be called from IRQ context, * unlike the blank functions above, so we may sleep. */ -static int imxfb_suspend (struct device *dev,pm_message_t state,u32 level) +static int imxfb_suspend (struct device *dev,pm_message_t state) {struct imxfb_info *fbi =dev_get_drvdata (dev);pr_debug ("%s\n" ,__FUNCTION__); -if (level ==SUSPEND_DISABLE || level ==SUSPEND_POWER_DOWN ) -imxfb_disable_controller (fbi); +imxfb_disable_controller (fbi);return 0 ; } -static int imxfb_resume (struct device *dev,u32 level) +static int imxfb_resume (struct device *dev) {struct imxfb_info *fbi =dev_get_drvdata (dev);pr_debug ("%s\n" ,__FUNCTION__); -if (level ==RESUME_ENABLE ) -imxfb_enable_controller (fbi); +imxfb_enable_controller (fbi);return 0 ; }#else
drivers/video/pxafb.c +4 -6
@@ -981,21 +981,19 @@ pxafb_freq_policy(struct notifier_block* Power management hooks. Note that we won't be called from IRQ context, * unlike the blank functions above, so we may sleep. */ -static int pxafb_suspend (struct device *dev,pm_message_t state,u32 level) +static int pxafb_suspend (struct device *dev,pm_message_t state) {struct pxafb_info *fbi =dev_get_drvdata (dev); -if (level ==SUSPEND_DISABLE || level ==SUSPEND_POWER_DOWN ) -set_ctrlr_state (fbi,C_DISABLE_PM ); +set_ctrlr_state (fbi,C_DISABLE_PM );return 0 ; } -static int pxafb_resume (struct device *dev,u32 level) +static int pxafb_resume (struct device *dev) {struct pxafb_info *fbi =dev_get_drvdata (dev); -if (level ==RESUME_ENABLE ) -set_ctrlr_state (fbi,C_ENABLE_PM ); +set_ctrlr_state (fbi,C_ENABLE_PM );return 0 ; }#else
drivers/video/s1d13xxxfb.c +2 -5
@@ -655,7 +655,7 @@ bail: }#ifdef CONFIG_PM -static int s1d13xxxfb_suspend (struct device *dev,pm_message_t state,u32 level) +static int s1d13xxxfb_suspend (struct device *dev,pm_message_t state) {struct fb_info *info =dev_get_drvdata (dev);struct s1d13xxxfb_par *s1dfb = info->par;
@@ -702,15 +702,12 @@ static int s1d13xxxfb_suspend(struct devreturn 0 ; } -static int s1d13xxxfb_resume (struct device *dev,u32 level) +static int s1d13xxxfb_resume (struct device *dev) {struct fb_info *info =dev_get_drvdata (dev);struct s1d13xxxfb_par *s1dfb = info->par;struct s1d13xxxfb_pdata *pdata =NULL ; -if (level !=RESUME_ENABLE ) -return 0 ; -/* awaken the chip */ s1d13xxxfb_writereg (s1dfb,S1DREG_PS_CNF ,0x10 );
drivers/video/s3c2410fb.c +12 -17
@@ -847,37 +847,32 @@ static int s3c2410fb_remove(struct devic/* suspend and resume support for the lcd controller */ -static int s3c2410fb_suspend (struct device *dev,pm_message_t state,u32 level) +static int s3c2410fb_suspend (struct device *dev,pm_message_t state) {struct fb_info *fbinfo =dev_get_drvdata (dev);struct s3c2410fb_info *info = fbinfo->par; -if (level ==SUSPEND_DISABLE || level ==SUSPEND_POWER_DOWN ) { -s3c2410fb_stop_lcd (); +s3c2410fb_stop_lcd (); -/* sleep before disabling the clock, we need to ensure -* the LCD DMA engine is not going to get back on the bus -* before the clock goes off again (bjd) */ - -msleep (1 ); -clk_disable (info->clk); - } +/* sleep before disabling the clock, we need to ensure +* the LCD DMA engine is not going to get back on the bus +* before the clock goes off again (bjd) */ + +msleep (1 ); +clk_disable (info->clk);return 0 ; } -static int s3c2410fb_resume (struct device *dev,u32 level) +static int s3c2410fb_resume (struct device *dev) {struct fb_info *fbinfo =dev_get_drvdata (dev);struct s3c2410fb_info *info = fbinfo->par; -if (level ==RESUME_ENABLE ) { -clk_enable (info->clk); -msleep (1 ); - -s3c2410fb_init_registers (info); +clk_enable (info->clk); +msleep (1 ); - } +s3c2410fb_init_registers (info);return 0 ; }
drivers/video/sa1100fb.c +4 -6
@@ -1309,21 +1309,19 @@ sa1100fb_freq_policy(struct notifier_blo* Power management hooks. Note that we won't be called from IRQ context, * unlike the blank functions above, so we may sleep. */ -static int sa1100fb_suspend (struct device *dev,pm_message_t state,u32 level) +static int sa1100fb_suspend (struct device *dev,pm_message_t state) {struct sa1100fb_info *fbi =dev_get_drvdata (dev); -if (level ==SUSPEND_DISABLE || level ==SUSPEND_POWER_DOWN ) -set_ctrlr_state (fbi,C_DISABLE_PM ); +set_ctrlr_state (fbi,C_DISABLE_PM );return 0 ; } -static int sa1100fb_resume (struct device *dev,u32 level) +static int sa1100fb_resume (struct device *dev) {struct sa1100fb_info *fbi =dev_get_drvdata (dev); -if (level ==RESUME_ENABLE ) -set_ctrlr_state (fbi,C_ENABLE_PM ); +set_ctrlr_state (fbi,C_ENABLE_PM );return 0 ; }#else
drivers/video/w100fb.c +23 -25
59 lines not on this page · raw message
include/linux/device.h +2 -15
@@ -28,19 +28,6 @@#define BUS_ID_SIZE KOBJ_NAME_LEN -enum { -SUSPEND_NOTIFY , -SUSPEND_SAVE_STATE , -SUSPEND_DISABLE , -SUSPEND_POWER_DOWN , -}; - -enum { -RESUME_POWER_ON , -RESUME_RESTORE_STATE , -RESUME_ENABLE , -}; -struct device ;struct device_driver ;struct class ;
@@ -115,8 +102,8 @@ struct device_driver {int (*probe) (struct device * dev);int (*remove) (struct device * dev);void (*shutdown) (struct device * dev); -int (*suspend) (struct device * dev,pm_message_t state,u32 level); -int (*resume) (struct device * dev,u32 level); +int (*suspend) (struct device * dev,pm_message_t state); +int (*resume) (struct device * dev); };
sound/arm/pxa2xx-ac97.c +4 -4
@@ -275,23 +275,23 @@ static int pxa2xx_ac97_do_resume(snd_carreturn 0 ; } -static int pxa2xx_ac97_suspend (struct device *_dev,pm_message_t state,u32 level) +static int pxa2xx_ac97_suspend (struct device *_dev,pm_message_t state) {snd_card_t *card =dev_get_drvdata (_dev);int ret =0 ; -if (card && level ==SUSPEND_DISABLE ) +if (card) ret =pxa2xx_ac97_do_suspend (card,PMSG_SUSPEND );return ret; } -static int pxa2xx_ac97_resume (struct device *_dev,u32 level) +static int pxa2xx_ac97_resume (struct device *_dev) {snd_card_t *card =dev_get_drvdata (_dev);int ret =0 ; -if (card && level ==RESUME_ENABLE ) +if (card) ret =pxa2xx_ac97_do_resume (card);return ret;
sound/core/init.c +4 -10
@@ -676,8 +676,8 @@ struct snd_generic_device {#define SND_GENERIC_NAME "snd_generic"#ifdef CONFIG_PM -static int snd_generic_suspend (struct device *dev,pm_message_t state,u32 level); -static int snd_generic_resume (struct device *dev,u32 level); +static int snd_generic_suspend (struct device *dev,pm_message_t state); +static int snd_generic_resume (struct device *dev);#endif /* initialized in sound.c */
@@ -818,13 +818,10 @@ int snd_card_set_pm_callback(snd_card_t#ifdef CONFIG_SND_GENERIC_DRIVER /* suspend/resume callbacks for snd_generic platform device */ -static int snd_generic_suspend (struct device *dev,pm_message_t state,u32 level) +static int snd_generic_suspend (struct device *dev,pm_message_t state) {snd_card_t *card; -if (level !=SUSPEND_DISABLE ) -return 0 ; - card =get_snd_generic_card (dev);if (card->power_state == SNDRV_CTL_POWER_D3hot)return 0 ;
@@ -834,13 +831,10 @@ static int snd_generic_suspend(struct dereturn 0 ; } -static int snd_generic_resume (struct device *dev,u32 level) +static int snd_generic_resume (struct device *dev) {snd_card_t *card; -if (level !=RESUME_ENABLE ) -return 0 ; - card =get_snd_generic_card (dev);if (card->power_state ==SNDRV_CTL_POWER_D0 )return 0 ;
sound/pci/ac97/ac97_bus.c +4 -2
@@ -31,7 +31,8 @@ static int ac97_bus_suspend(struct devicint ret =0 ;if (dev->driver && dev->driver->suspend) - ret = dev->driver->suspend (dev, state,SUSPEND_POWER_DOWN ); + ret = dev->driver->suspend (dev, state); +return ret; }
@@ -40,7 +41,8 @@ static int ac97_bus_resume(struct deviceint ret =0 ;if (dev->driver && dev->driver->resume) - ret = dev->driver->resume (dev,RESUME_POWER_ON ); + ret = dev->driver->resume (dev); +return ret; }
PATCH 1/1 Input: export input_dev data via sysfs attributes
In reply to Greg KH[PATCH] Input: export input_dev data via sysfs attributes
Input: export various input device attributes via sysfs
The following structure is exported:
input0/
|-- name
|-- phys
|-- uniq
|-- id/{bustype|vendor|product|version}
`-- capabilities/{ev|abs|rel|key|led|msc|ff|sw}---
commit 3792257a4fef9c098e39d2268fd31faf52b69200
tree 4678a7b8402693ce23c3af4cd1bcdc0dc7749b8a
parent 2870664a166086db34c99dfa2fc15e881131b45b
author Dmitry Torokhov <[email protected]> Thu, 15 Sep 2005 02:01:55 -0500 committer Greg Kroah-Hartman <[email protected]> Thu, 27 Oct 2005 22:48:06 -0700
drivers/input/input.c | 156 ++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 133 insertions(+), 23 deletions(-)
drivers/input/input.c +133 -23
@@ -434,6 +434,23 @@ static void input_call_hotplug(char *ver#endif +static int input_print_bitmap (char *buf,unsigned long *bitmap,int max) +{ +int i; +int len =0 ; + +for (i =NBITS (max) -1 ; i >0 ; i--) +if (bitmap[i]) +break ; + +for (; i >=0 ; i--) + len +=sprintf (buf + len,"%lx%s" , bitmap[i], i >0 ?" " :"" ); + + len +=sprintf (buf + len,"\n" ); + +return len; +} +#ifdef CONFIG_PROC_FS static struct proc_dir_entry *proc_bus_input_dir;
@@ -455,20 +472,17 @@ static unsigned int input_devices_poll(sreturn 0 ; } -#define SPRINTF_BIT_B (bit, name, max) \ - do { \ - len += sprintf(buf + len, "B: %s", name); \ - for (i = NBITS(max) - 1; i >= 0; i--) \ - if (dev->bit[i]) break; \ - for (; i >= 0; i--) \ - len += sprintf(buf + len, "%lx ", dev->bit[i]); \ - len += sprintf(buf + len, "\n"); \ +#define SPRINTF_BIT_B (ev, bm) \ + do { \ + len += sprintf(buf + len, "B: %s=", #ev); \ + len += input_print_bitmap(buf + len, \ + dev->bm##bit, ev##_MAX); \ } while (0) -#define SPRINTF_BIT_B2 (bit, name, max, ev) \ - do { \ - if (test_bit(ev, dev->evbit)) \ - SPRINTF_BIT_B(bit, name, max); \ +#define SPRINTF_BIT_B2 (ev, bm) \ + do { \ + if (test_bit(EV_##ev, dev->evbit)) \ + SPRINTF_BIT_B(ev, bm); \ } while (0)static int input_devices_read (char *buf,char **start,off_t pos,int count,int *eof,void *data)
@@ -478,7 +492,7 @@ static int input_devices_read(char *buf,const char *path;off_t at =0 ; -int i, len, cnt =0 ; +int len, cnt =0 ;list_for_each_entry (dev, &input_dev_list, node) {
@@ -497,15 +511,15 @@ static int input_devices_read(char *buf, len +=sprintf (buf + len,"\n" ); -SPRINTF_BIT_B (evbit,"EV=" ,EV_MAX ); -SPRINTF_BIT_B2 (keybit,"KEY=" ,KEY_MAX ,EV_KEY ); -SPRINTF_BIT_B2 (relbit,"REL=" ,REL_MAX ,EV_REL ); -SPRINTF_BIT_B2 (absbit,"ABS=" ,ABS_MAX ,EV_ABS ); -SPRINTF_BIT_B2 (mscbit,"MSC=" ,MSC_MAX ,EV_MSC ); -SPRINTF_BIT_B2 (ledbit,"LED=" ,LED_MAX ,EV_LED ); -SPRINTF_BIT_B2 (sndbit,"SND=" ,SND_MAX ,EV_SND ); -SPRINTF_BIT_B2 (ffbit,"FF=" ,FF_MAX ,EV_FF ); -SPRINTF_BIT_B2 (swbit,"SW=" ,SW_MAX ,EV_SW ); +SPRINTF_BIT_B (EV , ev); +SPRINTF_BIT_B2 (KEY , key); +SPRINTF_BIT_B2 (REL , rel); +SPRINTF_BIT_B2 (ABS , abs); +SPRINTF_BIT_B2 (MSC , msc); +SPRINTF_BIT_B2 (LED , led); +SPRINTF_BIT_B2 (SND , snd); +SPRINTF_BIT_B2 (FF , ff); +SPRINTF_BIT_B2 (SW , sw); len +=sprintf (buf + len,"\n" );
@@ -612,6 +626,96 @@ static inline int input_proc_init(void)static inline void input_proc_exit (void ) { }#endif +#define INPUT_DEV_STRING_ATTR_SHOW (name) \ +static ssize_t input_dev_show_##name(struct class_device *dev, char *buf) \ +{ \ + struct input_dev *input_dev = to_input_dev(dev); \ + int retval; \ + \ + retval = down_interruptible(&input_dev->sem); \ + if (retval) \ + return retval; \ + \ + retval = sprintf(buf, "%s\n", input_dev->name ? input_dev->name : ""); \ + \ + up(&input_dev->sem); \ + \ + return retval; \ +} + +INPUT_DEV_STRING_ATTR_SHOW (name); +INPUT_DEV_STRING_ATTR_SHOW (phys); +INPUT_DEV_STRING_ATTR_SHOW (uniq); + +static struct class_device_attribute input_dev_attrs[] = { +__ATTR (name,S_IRUGO , input_dev_show_name,NULL ), +__ATTR (phys,S_IRUGO , input_dev_show_phys,NULL ), +__ATTR (uniq,S_IRUGO , input_dev_show_uniq,NULL ), + __ATTR_NULL +}; + +#define INPUT_DEV_ID_ATTR (name) \ +static ssize_t input_dev_show_id_##name(struct class_device *dev, char *buf) \ +{ \ + struct input_dev *input_dev = to_input_dev(dev); \ + return sprintf(buf, "%04x\n", input_dev->id.name); \ +} \ +static CLASS_DEVICE_ATTR(name, S_IRUGO, input_dev_show_id_##name, NULL); + +INPUT_DEV_ID_ATTR (bustype); +INPUT_DEV_ID_ATTR (vendor); +INPUT_DEV_ID_ATTR (product); +INPUT_DEV_ID_ATTR (version); + +static struct attribute *input_dev_id_attrs[] = { + &class_device_attr_bustype.attr, + &class_device_attr_vendor.attr, + &class_device_attr_product.attr, + &class_device_attr_version.attr, +NULL +}; + +static struct attribute_group input_dev_id_attr_group = { + .name ="id" , + .attrs = input_dev_id_attrs, +}; + +#define INPUT_DEV_CAP_ATTR (ev, bm) \ +static ssize_t input_dev_show_cap_##bm(struct class_device *dev, char *buf) \ +{ \ + struct input_dev *input_dev = to_input_dev(dev); \ + return input_print_bitmap(buf, input_dev->bm##bit, ev##_MAX); \ +} \ +static CLASS_DEVICE_ATTR(bm, S_IRUGO, input_dev_show_cap_##bm, NULL); + +INPUT_DEV_CAP_ATTR (EV , ev); +INPUT_DEV_CAP_ATTR (KEY , key); +INPUT_DEV_CAP_ATTR (REL , rel); +INPUT_DEV_CAP_ATTR (ABS , abs); +INPUT_DEV_CAP_ATTR (MSC , msc); +INPUT_DEV_CAP_ATTR (LED , led); +INPUT_DEV_CAP_ATTR (SND , snd); +INPUT_DEV_CAP_ATTR (FF , ff); +INPUT_DEV_CAP_ATTR (SW , sw); + +static struct attribute *input_dev_caps_attrs[] = { + &class_device_attr_ev.attr, + &class_device_attr_key.attr, + &class_device_attr_rel.attr, + &class_device_attr_abs.attr, + &class_device_attr_msc.attr, + &class_device_attr_led.attr, + &class_device_attr_snd.attr, + &class_device_attr_ff.attr, + &class_device_attr_sw.attr, +NULL +}; + +static struct attribute_group input_dev_caps_attr_group = { + .name ="capabilities" , + .attrs = input_dev_caps_attrs, +}; +static void input_dev_release (struct class_device *class_dev) {struct input_dev *dev =to_input_dev (class_dev);
@@ -623,6 +727,7 @@ static void input_dev_release(struct clastatic struct class input_dev_class = { .name ="input_dev" , .release = input_dev_release, + .class_dev_attrs = input_dev_attrs, };struct input_dev *input_allocate_device (void )
@@ -660,6 +765,8 @@ static void input_register_classdevice(skfree (path);class_device_add (&dev->cdev); +sysfs_create_group (&dev->cdev.kobj, &input_dev_id_attr_group); +sysfs_create_group (&dev->cdev.kobj, &input_dev_caps_attr_group); }void input_register_device (struct input_dev *dev)
@@ -726,8 +833,11 @@ void input_unregister_device(struct inpulist_del_init (&dev->node); -if (dev->dynalloc) +if (dev->dynalloc) { +sysfs_remove_group (&dev->cdev.kobj, &input_dev_caps_attr_group); +sysfs_remove_group (&dev->cdev.kobj, &input_dev_id_attr_group);class_device_unregister (&dev->cdev); + }input_wakeup_procfs_readers (); }
PATCH 1/1 INPUT: move the input class devices under their new input_dev devices
In reply to Greg KH[PATCH] INPUT: move the input class devices under their new input_dev devices
---
commit ae2ea92c4fa1b32ab686bf48243b3671b3aa7c3a
tree f028ec6ef1b89db4620fa04b9b919079c6abee83
parent 67f440c4cac8a7073e113a0a7f201089123772a0
author Greg Kroah-Hartman <[email protected]> Thu, 27 Oct 2005 22:25:43 -0700 committer Greg Kroah-Hartman <[email protected]> Thu, 27 Oct 2005 22:48:06 -0700
drivers/input/evdev.c | 6 +++--- drivers/input/joydev.c | 6 +++--- drivers/input/mousedev.c | 10 +++++----- drivers/input/tsdev.c | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-)
drivers/input/evdev.c +3 -3
@@ -686,9 +686,9 @@ static struct input_handle *evdev_connec evdev_table[minor] = evdev; -class_device_create (input_class,NULL , +class_device_create (&input_dev_class, &dev->cdev,MKDEV (INPUT_MAJOR ,EVDEV_MINOR_BASE + minor), - dev->dev,"event%d" , minor); + dev->cdev.dev,"event%d" , minor);return &evdev->handle; }
@@ -698,7 +698,7 @@ static void evdev_disconnect(struct inpustruct evdev *evdev = handle->private;struct evdev_list *list; -class_device_destroy (input_class, +class_device_destroy (&input_dev_class,MKDEV (INPUT_MAJOR ,EVDEV_MINOR_BASE + evdev->minor)); evdev->exist =0 ;
drivers/input/joydev.c +3 -3
@@ -513,9 +513,9 @@ static struct input_handle *joydev_conne joydev_table[minor] = joydev; -class_device_create (input_class,NULL , +class_device_create (&input_dev_class, &dev->cdev,MKDEV (INPUT_MAJOR ,JOYDEV_MINOR_BASE + minor), - dev->dev,"js%d" , minor); + dev->cdev.dev,"js%d" , minor);return &joydev->handle; }
@@ -525,7 +525,7 @@ static void joydev_disconnect(struct inpstruct joydev *joydev = handle->private;struct joydev_list *list; -class_device_destroy (input_class,MKDEV (INPUT_MAJOR ,JOYDEV_MINOR_BASE + joydev->minor)); +class_device_destroy (&input_dev_class,MKDEV (INPUT_MAJOR ,JOYDEV_MINOR_BASE + joydev->minor)); joydev->exist =0 ;if (joydev->open) {
drivers/input/mousedev.c +5 -5
@@ -648,9 +648,9 @@ static struct input_handle *mousedev_con mousedev_table[minor] = mousedev; -class_device_create (input_class,NULL , +class_device_create (&input_dev_class, &dev->cdev,MKDEV (INPUT_MAJOR ,MOUSEDEV_MINOR_BASE + minor), - dev->dev,"mouse%d" , minor); + dev->cdev.dev,"mouse%d" , minor);return &mousedev->handle; }
@@ -660,7 +660,7 @@ static void mousedev_disconnect(struct istruct mousedev *mousedev = handle->private;struct mousedev_list *list; -class_device_destroy (input_class, +class_device_destroy (&input_dev_class,MKDEV (INPUT_MAJOR ,MOUSEDEV_MINOR_BASE + mousedev->minor)); mousedev->exist =0 ;
@@ -734,7 +734,7 @@ static int __init mousedev_init(void) mousedev_mix.exist =1 ; mousedev_mix.minor =MOUSEDEV_MIX ; -class_device_create (input_class,NULL , +class_device_create (&input_dev_class,NULL ,MKDEV (INPUT_MAJOR ,MOUSEDEV_MINOR_BASE +MOUSEDEV_MIX ),NULL ,"mice" );#ifdef CONFIG_INPUT_MOUSEDEV_PSAUX
@@ -753,7 +753,7 @@ static void __exit mousedev_exit(void)if (psaux_registered)misc_deregister (&psaux_mouse);#endif -class_device_destroy (input_class, +class_device_destroy (&input_dev_class,MKDEV (INPUT_MAJOR ,MOUSEDEV_MINOR_BASE +MOUSEDEV_MIX ));input_unregister_handler (&mousedev_handler); }
drivers/input/tsdev.c +3 -3
@@ -409,9 +409,9 @@ static struct input_handle *tsdev_connec tsdev_table[minor] = tsdev; -class_device_create (input_class,NULL , +class_device_create (&input_dev_class, &dev->cdev,MKDEV (INPUT_MAJOR ,TSDEV_MINOR_BASE + minor), - dev->dev,"ts%d" , minor); + dev->cdev.dev,"ts%d" , minor);return &tsdev->handle; }
@@ -421,7 +421,7 @@ static void tsdev_disconnect(struct inpustruct tsdev *tsdev = handle->private;struct tsdev_list *list; -class_device_destroy (input_class, +class_device_destroy (&input_dev_class,MKDEV (INPUT_MAJOR ,TSDEV_MINOR_BASE + tsdev->minor)); tsdev->exist =0 ;
PATCH 1/1 Input: convert sound/ppc/beep to dynamic input_dev allocation
In reply to Greg KH[PATCH] Input: convert sound/ppc/beep to dynamic input_dev allocation
Input: convert sound/ppc/beep to dynamic input_dev allocation
This is required for input_dev sysfs integration
---
commit 5555c7bc942fff098f65b233d1a47b611a81e7bc
tree ff723bc8e6f4b9d54ac19d1b7bebd9274dc5d15c
parent 08303093569fb58889c06a5920947fafc22b66ff
author Dmitry Torokhov <[email protected]> Thu, 15 Sep 2005 02:01:49 -0500 committer Greg Kroah-Hartman <[email protected]> Thu, 27 Oct 2005 22:48:05 -0700
sound/ppc/beep.c | 68 ++++++++++++++++++++++++++++++------------------------ 1 files changed, 38 insertions(+), 30 deletions(-)
sound/ppc/beep.c +38 -30
@@ -31,14 +31,14 @@#include "pmac.h" struct snd_pmac_beep { -int running;/* boolean */ -int volume;/* mixer volume: 0-100 */ +int running;/* boolean */ +int volume;/* mixer volume: 0-100 */ int volume_play;/* currently playing volume */ int hz;int nsamples;short *buf;/* allocated wave buffer */ dma_addr_t addr;/* physical address of buffer */ -struct input_dev dev; +struct input_dev *dev; };/*
@@ -212,47 +212,55 @@ static snd_kcontrol_new_t snd_pmac_beep_int __init snd_pmac_attach_beep (pmac_t *chip) {pmac_beep_t *beep; -int err; - - beep =kmalloc (sizeof (*beep),GFP_KERNEL ); -if (! beep) -return -ENOMEM ; - -memset (beep,0 ,sizeof (*beep)); - beep->buf =dma_alloc_coherent (&chip->pdev->dev,BEEP_BUFLEN *4 , - &beep->addr,GFP_KERNEL ); - - beep->dev.evbit[0 ] =BIT (EV_SND ); - beep->dev.sndbit[0 ] =BIT (SND_BELL ) |BIT (SND_TONE ); - beep->dev.event = snd_pmac_beep_event; - beep->dev.private = chip; +struct input_dev *input_dev; +void *dmabuf; +int err = -ENOMEM ; + + beep =kzalloc (sizeof (*beep),GFP_KERNEL ); + dmabuf =dma_alloc_coherent (&chip->pdev->dev,BEEP_BUFLEN *4 , + &beep->addr,GFP_KERNEL ); + input_dev =input_allocate_device (); +if (!beep || !dmabuf || !input_dev) + goto fail;/* FIXME: set more better values */ - beep->dev.name ="PowerMac Beep" ; - beep->dev.phys ="powermac/beep" ; - beep->dev.id.bustype =BUS_ADB ; - beep->dev.id.vendor =0x001f ; - beep->dev.id.product =0x0001 ; - beep->dev.id.version =0x0100 ; + input_dev->name ="PowerMac Beep" ; + input_dev->phys ="powermac/beep" ; + input_dev->id.bustype =BUS_ADB ; + input_dev->id.vendor =0x001f ; + input_dev->id.product =0x0001 ; + input_dev->id.version =0x0100 ; + + input_dev->evbit[0 ] =BIT (EV_SND ); + input_dev->sndbit[0 ] =BIT (SND_BELL ) |BIT (SND_TONE ); + input_dev->event = snd_pmac_beep_event; + input_dev->private = chip; + input_dev->cdev.dev = &chip->pdev->dev; + beep->dev = input_dev; + beep->buf = dmabuf; beep->volume =BEEP_VOLUME ; beep->running =0 ; -if ((err =snd_ctl_add (chip->card,snd_ctl_new1 (&snd_pmac_beep_mixer, chip))) <0 ) { -kfree (beep->buf); -kfree (beep); -return err; - } + + err =snd_ctl_add (chip->card,snd_ctl_new1 (&snd_pmac_beep_mixer, chip)); +if (err <0 ) + goto fail; chip->beep = beep; -input_register_device (&beep->dev); +input_register_device (beep->dev);return 0 ; + + fail:input_free_device (input_dev); +kfree (dmabuf); +kfree (beep); +return err; }void snd_pmac_detach_beep (pmac_t *chip) {if (chip->beep) { -input_unregister_device (&chip->beep->dev); +input_unregister_device (chip->beep->dev);dma_free_coherent (&chip->pdev->dev,BEEP_BUFLEN *4 , chip->beep->buf, chip->beep->addr);kfree (chip->beep);
PATCH 1/1 update required version of udev
In reply to Greg KH[PATCH] update required version of udev
The 071 release is needed to handle the input changes. Older versions will work properly with module-based systems, but not for users that build input stuff into the kernel.
---
commit c2458141eaa1fcfe3c09a9834784a2c2716012b3
tree 7c2b94c780a4253f6f4d796d6c96b4909b9c8f01
parent e9821c685cbf2d72f6d692117e83ff9b71c3315b
author Greg Kroah-Hartman <[email protected]> Thu, 27 Oct 2005 22:25:43 -0700 committer Greg Kroah-Hartman <[email protected]> Thu, 27 Oct 2005 22:48:07 -0700
Documentation/Changes | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Documentation/Changes +1 -1
@@ -65,7 +65,7 @@ o isdn4k-utils 3.1pre1 o nfs-utils 1.0.5 # showmount --version o procps 3.2.0 # ps --version o oprofile 0.9 # oprofiled --version -o udev 058 # udevinfo -V +o udev 071 # udevinfo -V Kernel compilation ==================
PATCH 1/1 INPUT: Create symlinks for backwards compatibility
In reply to Greg KH[PATCH] INPUT: Create symlinks for backwards compatibility
This creates symlinks in /sys/class/input/ to the nested class devices to help userspace cope with the nesting.
Unfortunatly udev still needs to be updated as it can't handle symlinks properly here :(
---
commit d608407b3691e3a1c20b382c81e0d00d3bf1e303
tree 95f8d5989d6af01aa635eefffb2bdf7eb0f536c3
parent fdbb989037a62b1748fdf3e292601a9373fa0739
author Greg Kroah-Hartman <[email protected]> Thu, 27 Oct 2005 22:25:43 -0700 committer Greg Kroah-Hartman <[email protected]> Thu, 27 Oct 2005 22:48:07 -0700
drivers/input/evdev.c | 10 ++++++++-- drivers/input/joydev.c | 10 ++++++++-- drivers/input/mousedev.c | 10 ++++++++-- drivers/input/tsdev.c | 10 ++++++++-- 4 files changed, 32 insertions(+), 8 deletions(-)
drivers/input/evdev.c +8 -2
@@ -661,6 +661,7 @@ static struct file_operations evdev_fopsstatic struct input_handle *evdev_connect (struct input_handler *handler,struct input_dev *dev,struct input_device_id *id) {struct evdev *evdev; +struct class_device *cdev;int minor;for (minor =0 ; minor <EVDEV_MINORS && evdev_table[minor]; minor++);
@@ -686,9 +687,13 @@ static struct input_handle *evdev_connec evdev_table[minor] = evdev; -class_device_create (&input_class, &dev->cdev, + cdev =class_device_create (&input_class, &dev->cdev,MKDEV (INPUT_MAJOR ,EVDEV_MINOR_BASE + minor), - dev->cdev.dev,"event%d" , minor); + dev->cdev.dev, evdev->name); + +/* temporary symlink to keep userspace happy */ +sysfs_create_link (&input_class.subsys.kset.kobj, &cdev->kobj, + evdev->name);return &evdev->handle; }
@@ -698,6 +703,7 @@ static void evdev_disconnect(struct inpustruct evdev *evdev = handle->private;struct evdev_list *list; +sysfs_remove_link (&input_class.subsys.kset.kobj, evdev->name);class_device_destroy (&input_class,MKDEV (INPUT_MAJOR ,EVDEV_MINOR_BASE + evdev->minor)); evdev->exist =0 ;
drivers/input/joydev.c +8 -2
@@ -448,6 +448,7 @@ static struct file_operations joydev_fopstatic struct input_handle *joydev_connect (struct input_handler *handler,struct input_dev *dev,struct input_device_id *id) {struct joydev *joydev; +struct class_device *cdev;int i, j, t, minor;for (minor =0 ; minor <JOYDEV_MINORS && joydev_table[minor]; minor++);
@@ -513,9 +514,13 @@ static struct input_handle *joydev_conne joydev_table[minor] = joydev; -class_device_create (&input_class, &dev->cdev, + cdev =class_device_create (&input_class, &dev->cdev,MKDEV (INPUT_MAJOR ,JOYDEV_MINOR_BASE + minor), - dev->cdev.dev,"js%d" , minor); + dev->cdev.dev, joydev->name); + +/* temporary symlink to keep userspace happy */ +sysfs_create_link (&input_class.subsys.kset.kobj, &cdev->kobj, + joydev->name);return &joydev->handle; }
@@ -525,6 +530,7 @@ static void joydev_disconnect(struct inpstruct joydev *joydev = handle->private;struct joydev_list *list; +sysfs_remove_link (&input_class.subsys.kset.kobj, joydev->name);class_device_destroy (&input_class,MKDEV (INPUT_MAJOR ,JOYDEV_MINOR_BASE + joydev->minor)); joydev->exist =0 ;
drivers/input/mousedev.c +8 -2
@@ -620,6 +620,7 @@ static struct file_operations mousedev_fstatic struct input_handle *mousedev_connect (struct input_handler *handler,struct input_dev *dev,struct input_device_id *id) {struct mousedev *mousedev; +struct class_device *cdev;int minor =0 ;for (minor =0 ; minor <MOUSEDEV_MINORS && mousedev_table[minor]; minor++);
@@ -648,9 +649,13 @@ static struct input_handle *mousedev_con mousedev_table[minor] = mousedev; -class_device_create (&input_class, &dev->cdev, + cdev =class_device_create (&input_class, &dev->cdev,MKDEV (INPUT_MAJOR ,MOUSEDEV_MINOR_BASE + minor), - dev->cdev.dev,"mouse%d" , minor); + dev->cdev.dev, mousedev->name); + +/* temporary symlink to keep userspace happy */ +sysfs_create_link (&input_class.subsys.kset.kobj, &cdev->kobj, + mousedev->name);return &mousedev->handle; }
@@ -660,6 +665,7 @@ static void mousedev_disconnect(struct istruct mousedev *mousedev = handle->private;struct mousedev_list *list; +sysfs_remove_link (&input_class.subsys.kset.kobj, mousedev->name);class_device_destroy (&input_class,MKDEV (INPUT_MAJOR ,MOUSEDEV_MINOR_BASE + mousedev->minor)); mousedev->exist =0 ;
drivers/input/tsdev.c +8 -2
@@ -368,6 +368,7 @@ static struct input_handle *tsdev_connec struct input_device_id *id) {struct tsdev *tsdev; +struct class_device *cdev;int minor, delta; for (minor = 0; minor < TSDEV_MINORS/2 && tsdev_table[minor];
@@ -409,9 +410,13 @@ static struct input_handle *tsdev_connec tsdev_table[minor] = tsdev; -class_device_create (&input_class, &dev->cdev, + cdev =class_device_create (&input_class, &dev->cdev,MKDEV (INPUT_MAJOR ,TSDEV_MINOR_BASE + minor), - dev->cdev.dev,"ts%d" , minor); + dev->cdev.dev, tsdev->name); + +/* temporary symlink to keep userspace happy */ +sysfs_create_link (&input_class.subsys.kset.kobj, &cdev->kobj, + tsdev->name);return &tsdev->handle; }
@@ -421,6 +426,7 @@ static void tsdev_disconnect(struct inpustruct tsdev *tsdev = handle->private;struct tsdev_list *list; +sysfs_remove_link (&input_class.subsys.kset.kobj, tsdev->name);class_device_destroy (&input_class,MKDEV (INPUT_MAJOR ,TSDEV_MINOR_BASE + tsdev->minor)); tsdev->exist =0 ;
PATCH 1/1 drivers/media: convert to dynamic input_dev allocation
In reply to Greg KH[PATCH] drivers/media: convert to dynamic input_dev allocation
Input: convert drivers/media to dynamic input_dev allocation
This is required for input_dev sysfs integration
---
commit 76537631e95b6e1a34bb78e1d45eb9e8c7e3de1d
tree 498f6a070b6cf125234dfdb08329ae46a42857bf
parent fa68a960b3f68ecabca13a8d6239ebe52435cff9
author Dmitry Torokhov <[email protected]> Thu, 15 Sep 2005 02:01:53 -0500 committer Greg Kroah-Hartman <[email protected]> Thu, 27 Oct 2005 22:48:05 -0700
drivers/media/common/ir-common.c | 1 drivers/media/dvb/cinergyT2/cinergyT2.c | 108 ++++++++++++++++++--------- drivers/media/dvb/dvb-usb/dvb-usb-remote.c | 50 +++++++------ drivers/media/dvb/dvb-usb/dvb-usb.h | 3 + drivers/media/dvb/ttpci/av7110_ir.c | 37 +++++---- drivers/media/dvb/ttpci/budget-ci.c | 24 +++--- drivers/media/dvb/ttusb-dec/ttusb_dec.c | 51 ++++++++----- drivers/media/video/bttvp.h | 2 - drivers/media/video/cx88/cx88-input.c | 58 ++++++++------- drivers/media/video/ir-kbd-gpio.c | 52 +++++++------ drivers/media/video/ir-kbd-i2c.c | 33 +++++--- drivers/media/video/saa7134/saa7134-input.c | 39 +++++----- drivers/media/video/saa7134/saa7134.h | 2 - 13 files changed, 268 insertions(+), 192 deletions(-)
drivers/media/common/ir-common.c +0 -1
@@ -252,7 +252,6 @@ void ir_input_init(struct input_dev *devif (ir_codes)memcpy (ir->ir_codes, ir_codes,sizeof (ir->ir_codes)); -init_input_dev (dev); dev->keycode = ir->ir_codes; dev->keycodesize =sizeof (IR_KEYTAB_TYPE ); dev->keycodemax =IR_KEYTAB_SIZE ;
drivers/media/dvb/cinergyT2/cinergyT2.c +70 -38
183 lines not on this page · raw message
drivers/media/dvb/dvb-usb/dvb-usb-remote.c +28 -22
106 lines not on this page · raw message
drivers/media/dvb/dvb-usb/dvb-usb.h +2 -1
@@ -300,7 +300,8 @@ struct dvb_usb_device {int (*fe_init) (struct dvb_frontend *);/* remote control */ -struct input_dev rc_input_dev; +struct input_dev *rc_input_dev; +char rc_phys[64 ];struct work_struct rc_query_work;u32 last_event;int last_state;
drivers/media/dvb/ttpci/av7110_ir.c +21 -16
@@ -15,7 +15,7 @@static int av_cnt;static struct av7110 *av_list[4 ]; -static struct input_dev input_dev; +static struct input_dev *input_dev;static u16 key_map [256 ] = {KEY_0 ,KEY_1 ,KEY_2 ,KEY_3 ,KEY_4 ,KEY_5 ,KEY_6 ,KEY_7 ,
@@ -43,10 +43,10 @@ static u16 key_map [256] = {static void av7110_emit_keyup (unsigned long data) { -if (!data || !test_bit (data, input_dev.key)) +if (!data || !test_bit (data, input_dev->key))return ; -input_event (&input_dev,EV_KEY , data, !!0 ); +input_event (input_dev,EV_KEY , data, !!0 ); }
@@ -112,13 +112,13 @@ static void av7110_emit_key(unsigned lonif (timer_pending (&keyup_timer)) {del_timer (&keyup_timer);if (keyup_timer.data != keycode || new_toggle != old_toggle) { -input_event (&input_dev,EV_KEY , keyup_timer.data, !!0 ); -input_event (&input_dev,EV_KEY , keycode, !0 ); +input_event (input_dev,EV_KEY , keyup_timer.data, !!0 ); +input_event (input_dev,EV_KEY , keycode, !0 ); }else -input_event (&input_dev,EV_KEY , keycode,2 ); +input_event (input_dev,EV_KEY , keycode,2 ); }else -input_event (&input_dev,EV_KEY , keycode, !0 ); +input_event (input_dev,EV_KEY , keycode, !0 ); keyup_timer.expires = jiffies +UP_TIMEOUT ; keyup_timer.data = keycode;
@@ -132,13 +132,13 @@ static void input_register_keys(void) {int i; -memset (input_dev.keybit,0 ,sizeof (input_dev.keybit)); +memset (input_dev->keybit,0 ,sizeof (input_dev->keybit)); -for (i =0 ; i <sizeof (key_map) /sizeof (key_map[0 ]); i++) { +for (i =0 ; i <ARRAY_SIZE (key_map); i++) {if (key_map[i] >KEY_MAX ) key_map[i] =0 ;else if (key_map[i] >KEY_RESERVED ) -set_bit (key_map[i], input_dev.keybit); +set_bit (key_map[i], input_dev->keybit); } }
@@ -216,12 +216,17 @@ int __init av7110_ir_init(struct av7110init_timer (&keyup_timer); keyup_timer.data =0 ; - input_dev.name ="DVB on-card IR receiver" ; -set_bit (EV_KEY , input_dev.evbit); -set_bit (EV_REP , input_dev.evbit); + input_dev =input_allocate_device (); +if (!input_dev) +return -ENOMEM ; + + input_dev->name ="DVB on-card IR receiver" ; + +set_bit (EV_KEY , input_dev->evbit); +set_bit (EV_REP , input_dev->evbit);input_register_keys (); -input_register_device (&input_dev); - input_dev.timer.function = input_repeat_key; +input_register_device (input_dev); + input_dev->timer.function = input_repeat_key; e =create_proc_entry ("av7110_ir" ,S_IFREG |S_IRUGO |S_IWUSR ,NULL );if (e) {
@@ -256,7 +261,7 @@ void __exit av7110_ir_exit(struct av7110if (av_cnt ==1 ) {del_timer_sync (&keyup_timer);remove_proc_entry ("av7110_ir" ,NULL ); -input_unregister_device (&input_dev); +input_unregister_device (input_dev); } av_cnt--;
drivers/media/dvb/ttpci/budget-ci.c +13 -11
@@ -64,7 +64,7 @@struct budget_ci {struct budget budget; -struct input_dev input_dev; +struct input_dev *input_dev;struct tasklet_struct msp430_irq_tasklet;struct tasklet_struct ciintf_irq_tasklet;int slot_status;
@@ -145,7 +145,7 @@ static void msp430_ir_debounce(unsignedstatic void msp430_ir_interrupt (unsigned long data) {struct budget_ci *budget_ci = (struct budget_ci *) data; -struct input_dev *dev = &budget_ci->input_dev; +struct input_dev *dev = budget_ci->input_dev;unsigned int code =ttpci_budget_debiread (&budget_ci->budget,DEBINOSWAP ,DEBIADDR_IR ,2 ,1 ,0 ) >>8 ;
@@ -181,25 +181,27 @@ static void msp430_ir_interrupt(unsignedstatic int msp430_ir_init (struct budget_ci *budget_ci) {struct saa7146_dev *saa = budget_ci->budget.dev; +struct input_dev *input_dev;int i; -memset (&budget_ci->input_dev,0 ,sizeof (struct input_dev )); + budget_ci->input_dev = input_dev =input_allocate_device (); +if (!input_dev) +return -ENOMEM ;sprintf (budget_ci->ir_dev_name,"Budget-CI dvb ir receiver %s" , saa->name); - budget_ci->input_dev.name = budget_ci->ir_dev_name; -set_bit (EV_KEY , budget_ci->input_dev.evbit); + input_dev->name = budget_ci->ir_dev_name; -for (i =0 ; i <sizeof (key_map) /sizeof (*key_map); i++) +set_bit (EV_KEY , input_dev->evbit); +for (i =0 ; i <ARRAY_SIZE (key_map); i++)if (key_map[i]) -set_bit (key_map[i], budget_ci->input_dev.keybit); +set_bit (key_map[i], input_dev->keybit); -input_register_device (&budget_ci->input_dev); +input_register_device (budget_ci->input_dev); - budget_ci->input_dev.timer.function = msp430_ir_debounce; + input_dev->timer.function = msp430_ir_debounce;saa7146_write (saa,IER ,saa7146_read (saa,IER ) |MASK_06 ); -saa7146_setgpio (saa,3 ,SAA7146_GPIO_IRQHI );return 0 ;
@@ -208,7 +210,7 @@ static int msp430_ir_init(struct budget_static void msp430_ir_deinit (struct budget_ci *budget_ci) {struct saa7146_dev *saa = budget_ci->budget.dev; -struct input_dev *dev = &budget_ci->input_dev; +struct input_dev *dev = budget_ci->input_dev;saa7146_write (saa,IER ,saa7146_read (saa,IER ) & ~MASK_06 );saa7146_setgpio (saa,3 ,SAA7146_GPIO_INPUT );
drivers/media/dvb/ttusb-dec/ttusb_dec.c +32 -19
98 lines not on this page · raw message
drivers/media/video/bttvp.h +1 -1
@@ -240,7 +240,7 @@ struct bttv_pll_info {/* for gpio-connected remote control */ struct bttv_input { -struct input_dev dev; +struct input_dev *dev;struct ir_input_state ir;char name[32 ];char phys[32 ];
drivers/media/video/cx88/cx88-input.c +32 -26
136 lines not on this page · raw message
drivers/media/video/ir-kbd-gpio.c +28 -24
112 lines not on this page · raw message
drivers/media/video/ir-kbd-i2c.c +19 -14
@@ -121,10 +121,9 @@ static IR_KEYTAB_TYPE ir_codes_purpletv[ }; -struct IR ;struct IR {struct i2c_client c; -struct input_dev input; +struct input_dev *input;struct ir_input_state ir;struct work_struct work;
@@ -271,9 +270,9 @@ static void ir_key_poll(struct IR *ir) }if (0 == rc) { -ir_input_nokey (&ir->input,&ir->ir); +ir_input_nokey (ir->input, &ir->ir); }else { -ir_input_keydown (&ir->input,&ir->ir, ir_key, ir_raw); +ir_input_keydown (ir->input, &ir->ir, ir_key, ir_raw); } }
@@ -318,11 +317,18 @@ static int ir_attach(struct i2c_adapterchar *name;int ir_type;struct IR *ir; +struct input_dev *input_dev; -if (NULL == (ir =kmalloc (sizeof (struct IR ),GFP_KERNEL ))) + ir =kzalloc (sizeof (struct IR ),GFP_KERNEL ); + input_dev =input_allocate_device (); +if (!ir || !input_dev) { +kfree (ir); +input_free_device (input_dev);return -ENOMEM ; -memset (ir,0 ,sizeof (*ir)); + } + ir->c = client_template; + ir->input = input_dev;i2c_set_clientdata (&ir->c, ir); ir->c.adapter = adap;
@@ -375,13 +381,12 @@ static int ir_attach(struct i2c_adapter ir->c.dev.bus_id);/* init + register input device */ -ir_input_init (&ir->input,&ir->ir,ir_type,ir_codes); - ir->input.id.bustype =BUS_I2C ; - ir->input.name = ir->c.name; - ir->input.phys = ir->phys; -input_register_device (&ir->input); -printk (DEVNAME ": %s detected at %s [%s]\n" , - ir->input.name,ir->input.phys,adap->name); +ir_input_init (input_dev, &ir->ir, ir_type, ir_codes); + input_dev->id.bustype =BUS_I2C ; + input_dev->name = ir->c.name; + input_dev->phys = ir->phys; + +input_register_device (ir->input);/* start polling via eventd */ INIT_WORK (&ir->work, ir_work, ir);
@@ -402,7 +407,7 @@ static int ir_detach(struct i2c_client *flush_scheduled_work ();/* unregister devices */ -input_unregister_device (&ir->input); +input_unregister_device (ir->input);i2c_detach_client (&ir->c);/* free memory */
drivers/media/video/saa7134/saa7134-input.c +21 -18
@@ -425,9 +425,9 @@ static int build_key(struct saa7134_devif ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) || (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) { -ir_input_keydown (&ir->dev,&ir->ir,data,data); +ir_input_keydown (ir->dev, &ir->ir, data, data); }else { -ir_input_nokey (&ir->dev,&ir->ir); +ir_input_nokey (ir->dev, &ir->ir); }return 0 ; }
@@ -456,6 +456,7 @@ static void saa7134_input_timer(unsignedint saa7134_input_init1 (struct saa7134_dev *dev) {struct saa7134_ir *ir; +struct input_dev *input_dev;IR_KEYTAB_TYPE *ir_codes =NULL ;u32 mask_keycode =0 ;u32 mask_keydown =0 ;
@@ -535,10 +536,13 @@ int saa7134_input_init1(struct saa7134_dreturn -ENODEV ; } - ir =kmalloc (sizeof (*ir),GFP_KERNEL ); -if (NULL == ir) + ir =kzalloc (sizeof (*ir),GFP_KERNEL ); + input_dev =input_allocate_device (); +if (!ir || !input_dev) { +kfree (ir); +input_free_device (input_dev);return -ENOMEM ; -memset (ir,0 ,sizeof (*ir)); + }/* init hardware-specific stuff */ ir->mask_keycode = mask_keycode;
@@ -552,19 +556,19 @@ int saa7134_input_init1(struct saa7134_dsnprintf (ir->phys,sizeof (ir->phys),"pci-%s/ir0" ,pci_name (dev->pci)); -ir_input_init (&ir->dev, &ir->ir, ir_type, ir_codes); - ir->dev.name = ir->name; - ir->dev.phys = ir->phys; - ir->dev.id.bustype =BUS_PCI ; - ir->dev.id.version =1 ; +ir_input_init (input_dev, &ir->ir, ir_type, ir_codes); + input_dev->name = ir->name; + input_dev->phys = ir->phys; + input_dev->id.bustype =BUS_PCI ; + input_dev->id.version =1 ;if (dev->pci->subsystem_vendor) { - ir->dev.id.vendor = dev->pci->subsystem_vendor; - ir->dev.id.product = dev->pci->subsystem_device; + input_dev->id.vendor = dev->pci->subsystem_vendor; + input_dev->id.product = dev->pci->subsystem_device; }else { - ir->dev.id.vendor = dev->pci->vendor; - ir->dev.id.product = dev->pci->device; + input_dev->id.vendor = dev->pci->vendor; + input_dev->id.product = dev->pci->device; } - ir->dev.dev = &dev->pci->dev; + input_dev->cdev.dev = &dev->pci->dev;/* all done */ dev->remote = ir;
@@ -576,8 +580,7 @@ int saa7134_input_init1(struct saa7134_dadd_timer (&ir->timer); } -input_register_device (&dev->remote->dev); -printk ("%s: registered input device for IR\n" ,dev->name); +input_register_device (ir->dev);return 0 ; }
@@ -586,9 +589,9 @@ void saa7134_input_fini(struct saa7134_dif (NULL == dev->remote)return ; -input_unregister_device (&dev->remote->dev);if (dev->remote->polling)del_timer_sync (&dev->remote->timer); +input_unregister_device (dev->remote->dev);kfree (dev->remote); dev->remote =NULL ; }
drivers/media/video/saa7134/saa7134.h +1 -1
@@ -351,7 +351,7 @@ struct saa7134_oss {/* IR input */ struct saa7134_ir { -struct input_dev dev; +struct input_dev *dev;struct ir_input_state ir;char name[32 ];char phys[32 ];
PATCH 1/1 INPUT: register the input class device sooner
In reply to Greg KH[PATCH] INPUT: register the input class device sooner
This is needed so we can actually use the class device within the input handlers.
---
commit 9c507854ead3fc14687b2402618b53ce4cea934a
tree fde0b34a166ecfe001929ef81d1c7d603d252d23
parent 3792257a4fef9c098e39d2268fd31faf52b69200
author Greg Kroah-Hartman <[email protected]> Thu, 27 Oct 2005 22:25:43 -0700 committer Greg Kroah-Hartman <[email protected]> Thu, 27 Oct 2005 22:48:06 -0700
drivers/input/input.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/input/input.c +3 -3
@@ -795,6 +795,9 @@ void input_register_device(struct input_INIT_LIST_HEAD (&dev->h_list);list_add_tail (&dev->node, &input_dev_list); +if (dev->dynalloc) +input_register_classdevice (dev); +list_for_each_entry (handler, &input_handler_list, node)if (!handler->blacklist || !input_match_device (handler->blacklist, dev))if ((id =input_match_device (handler->id_table, dev)))
@@ -802,9 +805,6 @@ void input_register_device(struct input_input_link_handle (handle); -if (dev->dynalloc) -input_register_classdevice (dev); -#ifdef CONFIG_HOTPLUG input_call_hotplug ("add" , dev);#endif
PATCH 1/1 Input: convert drivers/macintosh to dynamic input_dev allocation
In reply to a message not in the archive[PATCH] Input: convert drivers/macintosh to dynamic input_dev allocation
Input: convert drivers/macntosh to dynamic input_dev allocation
This is required for input_dev sysfs integration
---
commit 46aefdd22b2862771431be7e90a0b2c7d5d0524b
tree 7e6cb9b51e061b93776b68038222c76f53bd94d1
parent 76537631e95b6e1a34bb78e1d45eb9e8c7e3de1d
author Dmitry Torokhov <[email protected]> Thu, 15 Sep 2005 02:01:41 -0500 committer Greg Kroah-Hartman <[email protected]> Thu, 27 Oct 2005 22:48:05 -0700
drivers/macintosh/adbhid.c | 220 ++++++++++++++++++++++--------------------- drivers/macintosh/mac_hid.c | 44 +++++---- 2 files changed, 139 insertions(+), 125 deletions(-)
drivers/macintosh/adbhid.c +115 -105
@@ -206,7 +206,7 @@ u8 adb_to_linux_keycodes[128] = { };struct adbhid { -struct input_dev input; +struct input_dev *input;int id;int default_id;int original_handler_id;
@@ -291,10 +291,10 @@ adbhid_input_keycode(int id, int keycodeswitch (keycode) {case ADB_KEY_CAPSLOCK :/* Generate down/up events for CapsLock everytime. */ -input_regs (&ahid->input, regs); -input_report_key (&ahid->input,KEY_CAPSLOCK ,1 ); -input_report_key (&ahid->input,KEY_CAPSLOCK ,0 ); -input_sync (&ahid->input); +input_regs (ahid->input, regs); +input_report_key (ahid->input,KEY_CAPSLOCK ,1 ); +input_report_key (ahid->input,KEY_CAPSLOCK ,0 ); +input_sync (ahid->input);return ;#ifdef CONFIG_PPC_PMAC case ADB_KEY_POWER_OLD :/* Power key on PBook 3400 needs remapping */
@@ -347,10 +347,10 @@ adbhid_input_keycode(int id, int keycode }if (adbhid[id]->keycode[keycode]) { -input_regs (&adbhid[id]->input, regs); -input_report_key (&adbhid[id]->input, +input_regs (adbhid[id]->input, regs); +input_report_key (adbhid[id]->input, adbhid[id]->keycode[keycode], !up_flag); -input_sync (&adbhid[id]->input); +input_sync (adbhid[id]->input); }else printk (KERN_INFO "Unhandled ADB key (scancode %#02x) %s.\n" , keycode, up_flag ?"released" :"pressed" );
@@ -441,20 +441,20 @@ adbhid_mouse_input(unsigned char *data,break ; } -input_regs (&adbhid[id]->input, regs); +input_regs (adbhid[id]->input, regs); -input_report_key (&adbhid[id]->input,BTN_LEFT , !((data[1 ] >>7 ) &1 )); -input_report_key (&adbhid[id]->input,BTN_MIDDLE , !((data[2 ] >>7 ) &1 )); +input_report_key (adbhid[id]->input,BTN_LEFT , !((data[1 ] >>7 ) &1 )); +input_report_key (adbhid[id]->input,BTN_MIDDLE , !((data[2 ] >>7 ) &1 ));if (nb >=4 && adbhid[id]->mouse_kind !=ADBMOUSE_TRACKPAD ) -input_report_key (&adbhid[id]->input,BTN_RIGHT , !((data[3 ] >>7 ) &1 )); +input_report_key (adbhid[id]->input,BTN_RIGHT , !((data[3 ] >>7 ) &1 )); -input_report_rel (&adbhid[id]->input,REL_X , +input_report_rel (adbhid[id]->input,REL_X , ((data[2 ]&0x7f ) <64 ? (data[2 ]&0x7f ) : (data[2 ]&0x7f )-128 )); -input_report_rel (&adbhid[id]->input,REL_Y , +input_report_rel (adbhid[id]->input,REL_Y , ((data[1 ]&0x7f ) <64 ? (data[1 ]&0x7f ) : (data[1 ]&0x7f )-128 )); -input_sync (&adbhid[id]->input); +input_sync (adbhid[id]->input); } static void
@@ -467,7 +467,7 @@ adbhid_buttons_input(unsigned char *datareturn ; } -input_regs (&adbhid[id]->input, regs); +input_regs (adbhid[id]->input, regs);switch (adbhid[id]->original_handler_id) {default :
@@ -477,19 +477,19 @@ adbhid_buttons_input(unsigned char *dataswitch (data[1 ] &0x0f ) {case 0x0 :/* microphone */ -input_report_key (&adbhid[id]->input,KEY_SOUND , down); +input_report_key (adbhid[id]->input,KEY_SOUND , down);break ;case 0x1 :/* mute */ -input_report_key (&adbhid[id]->input,KEY_MUTE , down); +input_report_key (adbhid[id]->input,KEY_MUTE , down);break ;case 0x2 :/* volume decrease */ -input_report_key (&adbhid[id]->input,KEY_VOLUMEDOWN , down); +input_report_key (adbhid[id]->input,KEY_VOLUMEDOWN , down);break ;case 0x3 :/* volume increase */ -input_report_key (&adbhid[id]->input,KEY_VOLUMEUP , down); +input_report_key (adbhid[id]->input,KEY_VOLUMEUP , down);break ;default :
@@ -513,19 +513,19 @@ adbhid_buttons_input(unsigned char *dataswitch (data[1 ] &0x0f ) {case 0x8 :/* mute */ -input_report_key (&adbhid[id]->input,KEY_MUTE , down); +input_report_key (adbhid[id]->input,KEY_MUTE , down);break ;case 0x7 :/* volume decrease */ -input_report_key (&adbhid[id]->input,KEY_VOLUMEDOWN , down); +input_report_key (adbhid[id]->input,KEY_VOLUMEDOWN , down);break ;case 0x6 :/* volume increase */ -input_report_key (&adbhid[id]->input,KEY_VOLUMEUP , down); +input_report_key (adbhid[id]->input,KEY_VOLUMEUP , down);break ;case 0xb :/* eject */ -input_report_key (&adbhid[id]->input,KEY_EJECTCD , down); +input_report_key (adbhid[id]->input,KEY_EJECTCD , down);break ;case 0xa :/* brightness decrease */
@@ -539,7 +539,7 @@ adbhid_buttons_input(unsigned char *data } }#endif /* CONFIG_PMAC_BACKLIGHT */ -input_report_key (&adbhid[id]->input,KEY_BRIGHTNESSDOWN , down); +input_report_key (adbhid[id]->input,KEY_BRIGHTNESSDOWN , down);break ;case 0x9 :/* brightness increase */
@@ -553,19 +553,19 @@ adbhid_buttons_input(unsigned char *data } }#endif /* CONFIG_PMAC_BACKLIGHT */ -input_report_key (&adbhid[id]->input,KEY_BRIGHTNESSUP , down); +input_report_key (adbhid[id]->input,KEY_BRIGHTNESSUP , down);break ;case 0xc :/* videomode switch */ -input_report_key (&adbhid[id]->input,KEY_SWITCHVIDEOMODE , down); +input_report_key (adbhid[id]->input,KEY_SWITCHVIDEOMODE , down);break ;case 0xd :/* keyboard illumination toggle */ -input_report_key (&adbhid[id]->input,KEY_KBDILLUMTOGGLE , down); +input_report_key (adbhid[id]->input,KEY_KBDILLUMTOGGLE , down);break ;case 0xe :/* keyboard illumination decrease */ -input_report_key (&adbhid[id]->input,KEY_KBDILLUMDOWN , down); +input_report_key (adbhid[id]->input,KEY_KBDILLUMDOWN , down);break ;case 0xf :
@@ -573,7 +573,7 @@ adbhid_buttons_input(unsigned char *datacase 0x8f :case 0x0f :/* keyboard illumination increase */ -input_report_key (&adbhid[id]->input,KEY_KBDILLUMUP , down); +input_report_key (adbhid[id]->input,KEY_KBDILLUMUP , down);break ;case 0x7f :
@@ -596,7 +596,7 @@ adbhid_buttons_input(unsigned char *databreak ; } -input_sync (&adbhid[id]->input); +input_sync (adbhid[id]->input); }static struct adb_request led_request;
@@ -683,7 +683,7 @@ adb_message_handler(struct notifier_blocint i;for (i =1 ; i <16 ; i++) {if (adbhid[i]) -del_timer_sync (&adbhid[i]->input.timer); +del_timer_sync (&adbhid[i]->input->timer); } }
@@ -699,153 +699,163 @@ adb_message_handler(struct notifier_blocreturn NOTIFY_DONE ; } -static void +static int adbhid_input_register (int id,int default_id,int original_handler_id,int current_handler_id,int mouse_kind) { +struct adbhid *hid; +struct input_dev *input_dev; +int err;int i;if (adbhid[id]) {printk (KERN_ERR "Trying to reregister ADB HID on ID %d\n" , id); -return ; +return -EEXIST ; } -if (!(adbhid[id] =kmalloc (sizeof (struct adbhid ),GFP_KERNEL ))) -return ; - -memset (adbhid[id],0 ,sizeof (struct adbhid )); -sprintf (adbhid[id]->phys,"adb%d:%d.%02x/input" , id, default_id, original_handler_id); + adbhid[id] = hid =kzalloc (sizeof (struct adbhid ),GFP_KERNEL ); + input_dev =input_allocate_device (); +if (!hid || !input_dev) { + err = -ENOMEM ; + goto fail; -init_input_dev (&adbhid[id]->input); + } - adbhid[id]->id = default_id; - adbhid[id]->original_handler_id = original_handler_id; - adbhid[id]->current_handler_id = current_handler_id; - adbhid[id]->mouse_kind = mouse_kind; - adbhid[id]->flags =0 ; - adbhid[id]->input.private = adbhid[id]; - adbhid[id]->input.name = adbhid[id]->name; - adbhid[id]->input.phys = adbhid[id]->phys; - adbhid[id]->input.id.bustype =BUS_ADB ; - adbhid[id]->input.id.vendor =0x0001 ; - adbhid[id]->input.id.product = (id <<12 ) | (default_id <<8 ) | original_handler_id; - adbhid[id]->input.id.version =0x0100 ; +sprintf (hid->phys,"adb%d:%d.%02x/input" , id, default_id, original_handler_id); + + hid->id = default_id; + hid->original_handler_id = original_handler_id; + hid->current_handler_id = current_handler_id; + hid->mouse_kind = mouse_kind; + hid->flags =0 ; + input_dev->private = hid; + input_dev->name = hid->name; + input_dev->phys = hid->phys; + input_dev->id.bustype =BUS_ADB ; + input_dev->id.vendor =0x0001 ; + input_dev->id.product = (id <<12 ) | (default_id <<8 ) | original_handler_id; + input_dev->id.version =0x0100 ;switch (default_id) {case ADB_KEYBOARD : -if (!(adbhid[id]->keycode =kmalloc (sizeof (adb_to_linux_keycodes),GFP_KERNEL ))) { -kfree (adbhid[id]); -return ; + hid->keycode =kmalloc (sizeof (adb_to_linux_keycodes),GFP_KERNEL ); +if (!hid->keycode) { + err = -ENOMEM ; + goto fail; } -sprintf (adbhid[id]->name,"ADB keyboard" ); +sprintf (hid->name,"ADB keyboard" ); -memcpy (adbhid[id]->keycode, adb_to_linux_keycodes,sizeof (adb_to_linux_keycodes)); +memcpy (hid->keycode, adb_to_linux_keycodes,sizeof (adb_to_linux_keycodes));printk (KERN_INFO "Detected ADB keyboard, type " );switch (original_handler_id) {default :printk ("<unknown>.\n" ); - adbhid[id]->input.id.version =ADB_KEYBOARD_UNKNOWN ; + input_dev->id.version =ADB_KEYBOARD_UNKNOWN ;break ;case 0x01 :case 0x02 :case 0x03 :case 0x06 :case 0x08 :case 0x0C :case 0x10 :case 0x18 :case 0x1B :case 0x1C :case 0xC0 :case 0xC3 :case 0xC6 :printk ("ANSI.\n" ); - adbhid[id]->input.id.version =ADB_KEYBOARD_ANSI ; + input_dev->id.version =ADB_KEYBOARD_ANSI ;break ;case 0x04 :case 0x05 :case 0x07 :case 0x09 :case 0x0D :case 0x11 :case 0x14 :case 0x19 :case 0x1D :case 0xC1 :case 0xC4 :case 0xC7 :printk ("ISO, swapping keys.\n" ); - adbhid[id]->input.id.version =ADB_KEYBOARD_ISO ; - i = adbhid[id]->keycode[10 ]; - adbhid[id]->keycode[10 ] = adbhid[id]->keycode[50 ]; - adbhid[id]->keycode[50 ] = i; + input_dev->id.version =ADB_KEYBOARD_ISO ; + i = hid->keycode[10 ]; + hid->keycode[10 ] = hid->keycode[50 ]; + hid->keycode[50 ] = i;break ;case 0x12 :case 0x15 :case 0x16 :case 0x17 :case 0x1A :case 0x1E :case 0xC2 :case 0xC5 :case 0xC8 :case 0xC9 :printk ("JIS.\n" ); - adbhid[id]->input.id.version =ADB_KEYBOARD_JIS ; + input_dev->id.version =ADB_KEYBOARD_JIS ;break ; }for (i =0 ; i <128 ; i++) -if (adbhid[id]->keycode[i]) -set_bit (adbhid[id]->keycode[i], adbhid[id]->input.keybit); +if (hid->keycode[i]) +set_bit (hid->keycode[i], input_dev->keybit); - adbhid[id]->input.evbit[0 ] =BIT (EV_KEY ) |BIT (EV_LED ) |BIT (EV_REP ); - adbhid[id]->input.ledbit[0 ] =BIT (LED_SCROLLL ) |BIT (LED_CAPSL ) |BIT (LED_NUML ); - adbhid[id]->input.event = adbhid_kbd_event; - adbhid[id]->input.keycodemax =127 ; - adbhid[id]->input.keycodesize =1 ; + input_dev->evbit[0 ] =BIT (EV_KEY ) |BIT (EV_LED ) |BIT (EV_REP ); + input_dev->ledbit[0 ] =BIT (LED_SCROLLL ) |BIT (LED_CAPSL ) |BIT (LED_NUML ); + input_dev->event = adbhid_kbd_event; + input_dev->keycodemax =127 ; + input_dev->keycodesize =1 ;break ;case ADB_MOUSE : -sprintf (adbhid[id]->name,"ADB mouse" ); +sprintf (hid->name,"ADB mouse" ); - adbhid[id]->input.evbit[0 ] =BIT (EV_KEY ) |BIT (EV_REL ); - adbhid[id]->input.keybit[LONG (BTN_MOUSE )] =BIT (BTN_LEFT ) |BIT (BTN_MIDDLE ) |BIT (BTN_RIGHT ); - adbhid[id]->input.relbit[0 ] =BIT (REL_X ) |BIT (REL_Y ); + input_dev->evbit[0 ] =BIT (EV_KEY ) |BIT (EV_REL ); + input_dev->keybit[LONG (BTN_MOUSE )] =BIT (BTN_LEFT ) |BIT (BTN_MIDDLE ) |BIT (BTN_RIGHT ); + input_dev->relbit[0 ] =BIT (REL_X ) |BIT (REL_Y );break ;case ADB_MISC :switch (original_handler_id) {case 0x02 :/* Adjustable keyboard button device */ -sprintf (adbhid[id]->name,"ADB adjustable keyboard buttons" ); - adbhid[id]->input.evbit[0 ] =BIT (EV_KEY ) |BIT (EV_REP ); -set_bit (KEY_SOUND , adbhid[id]->input.keybit); -set_bit (KEY_MUTE , adbhid[id]->input.keybit); -set_bit (KEY_VOLUMEUP , adbhid[id]->input.keybit); -set_bit (KEY_VOLUMEDOWN , adbhid[id]->input.keybit); +sprintf (hid->name,"ADB adjustable keyboard buttons" ); + input_dev->evbit[0 ] =BIT (EV_KEY ) |BIT (EV_REP ); +set_bit (KEY_SOUND , input_dev->keybit); +set_bit (KEY_MUTE , input_dev->keybit); +set_bit (KEY_VOLUMEUP , input_dev->keybit); +set_bit (KEY_VOLUMEDOWN , input_dev->keybit);break ;case 0x1f :/* Powerbook button device */ -sprintf (adbhid[id]->name,"ADB Powerbook buttons" ); - adbhid[id]->input.evbit[0 ] =BIT (EV_KEY ) |BIT (EV_REP ); -set_bit (KEY_MUTE , adbhid[id]->input.keybit); -set_bit (KEY_VOLUMEUP , adbhid[id]->input.keybit); -set_bit (KEY_VOLUMEDOWN , adbhid[id]->input.keybit); -set_bit (KEY_BRIGHTNESSUP , adbhid[id]->input.keybit); -set_bit (KEY_BRIGHTNESSDOWN , adbhid[id]->input.keybit); -set_bit (KEY_EJECTCD , adbhid[id]->input.keybit); -set_bit (KEY_SWITCHVIDEOMODE , adbhid[id]->input.keybit); -set_bit (KEY_KBDILLUMTOGGLE , adbhid[id]->input.keybit); -set_bit (KEY_KBDILLUMDOWN , adbhid[id]->input.keybit); -set_bit (KEY_KBDILLUMUP , adbhid[id]->input.keybit); +sprintf (hid->name,"ADB Powerbook buttons" ); + input_dev->evbit[0 ] =BIT (EV_KEY ) |BIT (EV_REP ); +set_bit (KEY_MUTE , input_dev->keybit); +set_bit (KEY_VOLUMEUP , input_dev->keybit); +set_bit (KEY_VOLUMEDOWN , input_dev->keybit); +set_bit (KEY_BRIGHTNESSUP , input_dev->keybit); +set_bit (KEY_BRIGHTNESSDOWN , input_dev->keybit); +set_bit (KEY_EJECTCD , input_dev->keybit); +set_bit (KEY_SWITCHVIDEOMODE , input_dev->keybit); +set_bit (KEY_KBDILLUMTOGGLE , input_dev->keybit); +set_bit (KEY_KBDILLUMDOWN , input_dev->keybit); +set_bit (KEY_KBDILLUMUP , input_dev->keybit);break ; } -if (adbhid[id]->name[0 ]) +if (hid->name[0 ])break ;/* else fall through */ default :printk (KERN_INFO "Trying to register unknown ADB device to input layer.\n" ); -kfree (adbhid[id]); -return ; + err = -ENODEV ; + goto fail; } - adbhid[id]->input.keycode = adbhid[id]->keycode; - -input_register_device (&adbhid[id]->input); + input_dev->keycode = hid->keycode; -printk (KERN_INFO "input: %s on %s\n" , - adbhid[id]->name, adbhid[id]->phys); +input_register_device (input_dev);if (default_id ==ADB_KEYBOARD ) {/* HACK WARNING!! This should go away as soon there is an utility * to control that for event devices. */ - adbhid[id]->input.rep[REP_DELAY ] =500 ;/* input layer default: 250 */ - adbhid[id]->input.rep[REP_PERIOD ] =66 ;/* input layer default: 33 */ + input_dev->rep[REP_DELAY ] =500 ;/* input layer default: 250 */ + input_dev->rep[REP_PERIOD ] =66 ;/* input layer default: 33 */ } + +return 0 ; + + fail:input_free_device (input_dev); +kfree (hid); + adbhid[id] =NULL ; +return err; }static void adbhid_input_unregister (int id) { -input_unregister_device (&adbhid[id]->input); +input_unregister_device (adbhid[id]->input);if (adbhid[id]->keycode)kfree (adbhid[id]->keycode);kfree (adbhid[id]);
@@ -858,7 +868,7 @@ adbhid_input_reregister(int id, int defa int cur_handler_id, int mk) { if (adbhid[id]) { - if (adbhid[id]->input.id.product != + if (adbhid[id]->input->id.product != ((id << 12)|(default_id << 8)|org_handler_id)) {adbhid_input_unregister (id ); adbhid_input_register(id, default_id, org_handler_id,
drivers/macintosh/mac_hid.c +24 -20
72 lines not on this page · raw message
PATCH 1/1 input core: remove custom-made hotplug handler
In reply to Greg KH[PATCH] input core: remove custom-made hotplug handler
Input: remove custom-made hotplug handler
Now that all input devices are registered with sysfs we can remove old custom-made hotplug handler and crate a standard one.
---
commit 104d94a7ef01bb62f2be1d59c7580c1a6f3478d5
tree 8dcb8db9f3912549366d6307edb12c10755051b0
parent d608407b3691e3a1c20b382c81e0d00d3bf1e303
author Dmitry Torokhov <[email protected]> Thu, 15 Sep 2005 02:01:57 -0500 committer Greg Kroah-Hartman <[email protected]> Thu, 27 Oct 2005 22:48:07 -0700
drivers/input/input.c | 249 ++++++++++++++++++++----------------------------- 1 files changed, 104 insertions(+), 145 deletions(-)
drivers/input/input.c +104 -145
@@ -316,125 +316,7 @@ static struct input_device_id *input_matreturn NULL ; } - -/* -* Input hotplugging interface - loading event handlers based on -* device bitfields. -*/ - -#ifdef CONFIG_HOTPLUG - -/* -* Input hotplugging invokes what /proc/sys/kernel/hotplug says -* (normally /sbin/hotplug) when input devices get added or removed. -* -* This invokes a user mode policy agent, typically helping to load driver -* or other modules, configure the device, and more. Drivers can provide -* a MODULE_DEVICE_TABLE to help with module loading subtasks. -* -*/ - -#define SPRINTF_BIT_A (bit, name, max) \ - do { \ - envp[i++] = scratch; \ - scratch += sprintf(scratch, name); \ - for (j = NBITS(max) - 1; j >= 0; j--) \ - if (dev->bit[j]) break; \ - for (; j >= 0; j--) \ - scratch += sprintf(scratch, "%lx ", dev->bit[j]); \ - scratch++; \ - } while (0) - -#define SPRINTF_BIT_A2 (bit, name, max, ev) \ - do { \ - if (test_bit(ev, dev->evbit)) \ - SPRINTF_BIT_A(bit, name, max); \ - } while (0) - -static void input_call_hotplug (char *verb,struct input_dev *dev) -{ -char *argv[3 ], **envp, *buf, *scratch; -int i =0 , j, value; - -if (!hotplug_path[0 ]) { -printk (KERN_ERR "input.c: calling hotplug without a hotplug agent defined\n" ); -return ; - } -if (in_interrupt ()) { -printk (KERN_ERR "input.c: calling hotplug from interrupt\n" ); -return ; - } -if (!current->fs->root) { -printk (KERN_WARNING "input.c: calling hotplug without valid filesystem\n" ); -return ; - } -if (!(envp = (char **)kmalloc (20 *sizeof (char *),GFP_KERNEL ))) { -printk (KERN_ERR "input.c: not enough memory allocating hotplug environment\n" ); -return ; - } -if (!(buf =kmalloc (1024 ,GFP_KERNEL ))) { -kfree (envp); -printk (KERN_ERR "input.c: not enough memory allocating hotplug environment\n" ); -return ; - } - - argv[0 ] = hotplug_path; - argv[1 ] ="input" ; - argv[2 ] =NULL ; - - envp[i++] ="HOME=/" ; - envp[i++] ="PATH=/sbin:/bin:/usr/sbin:/usr/bin" ; - - scratch = buf; - - envp[i++] = scratch; - scratch +=sprintf (scratch,"ACTION=%s" , verb) +1 ; - - envp[i++] = scratch; - scratch +=sprintf (scratch,"PRODUCT=%x/%x/%x/%x" , - dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version) +1 ; - -if (dev->name) { - envp[i++] = scratch; - scratch +=sprintf (scratch,"NAME=%s" , dev->name) +1 ; - } - -if (dev->phys) { - envp[i++] = scratch; - scratch +=sprintf (scratch,"PHYS=%s" , dev->phys) +1 ; - } - -SPRINTF_BIT_A (evbit,"EV=" ,EV_MAX ); -SPRINTF_BIT_A2 (keybit,"KEY=" ,KEY_MAX ,EV_KEY ); -SPRINTF_BIT_A2 (relbit,"REL=" ,REL_MAX ,EV_REL ); -SPRINTF_BIT_A2 (absbit,"ABS=" ,ABS_MAX ,EV_ABS ); -SPRINTF_BIT_A2 (mscbit,"MSC=" ,MSC_MAX ,EV_MSC ); -SPRINTF_BIT_A2 (ledbit,"LED=" ,LED_MAX ,EV_LED ); -SPRINTF_BIT_A2 (sndbit,"SND=" ,SND_MAX ,EV_SND ); -SPRINTF_BIT_A2 (ffbit,"FF=" ,FF_MAX ,EV_FF ); -SPRINTF_BIT_A2 (swbit,"SW=" ,SW_MAX ,EV_SW ); - - envp[i++] =NULL ; - -#ifdef INPUT_DEBUG -printk (KERN_DEBUG "input.c: calling %s %s [%s %s %s %s %s]\n" , - argv[0 ], argv[1 ], envp[0 ], envp[1 ], envp[2 ], envp[3 ], envp[4 ]); -#endif - - value =call_usermodehelper (argv [0 ], argv, envp,0 ); - -kfree (buf); -kfree (envp); - -#ifdef INPUT_DEBUG -if (value !=0 ) -printk (KERN_DEBUG "input.c: hotplug returned %d\n" , value); -#endif -} - -#endif - -static int input_print_bitmap (char *buf,unsigned long *bitmap,int max) +static int input_print_bitmap (char *buf,int buf_size,unsigned long *bitmap,int max) {int i;int len =0 ;
@@ -444,10 +326,8 @@ static int input_print_bitmap(char *buf,break ;for (; i >=0 ; i--) - len +=sprintf (buf + len,"%lx%s" , bitmap[i], i >0 ?" " :"" ); - - len +=sprintf (buf + len,"\n" ); - + len +=snprintf (buf + len,max (buf_size - len,0 ), +"%lx%s" , bitmap[i], i >0 ?" " :"" );return len; }
@@ -472,17 +352,18 @@ static unsigned int input_devices_poll(sreturn 0 ; } -#define SPRINTF_BIT_B (ev, bm) \ +#define SPRINTF_BIT (ev, bm) \ do { \ len += sprintf(buf + len, "B: %s=", #ev); \ - len += input_print_bitmap(buf + len, \ + len += input_print_bitmap(buf + len, INT_MAX, \ dev->bm##bit, ev##_MAX); \ + len += sprintf(buf + len, "\n"); \ } while (0) -#define SPRINTF_BIT_B2 (ev, bm) \ +#define TEST_AND_SPRINTF_BIT (ev, bm) \ do { \ if (test_bit(EV_##ev, dev->evbit)) \ - SPRINTF_BIT_B(ev, bm); \ + SPRINTF_BIT(ev, bm); \ } while (0)static int input_devices_read (char *buf,char **start,off_t pos,int count,int *eof,void *data)
@@ -511,15 +392,15 @@ static int input_devices_read(char *buf, len +=sprintf (buf + len,"\n" ); -SPRINTF_BIT_B (EV , ev); -SPRINTF_BIT_B2 (KEY , key); -SPRINTF_BIT_B2 (REL , rel); -SPRINTF_BIT_B2 (ABS , abs); -SPRINTF_BIT_B2 (MSC , msc); -SPRINTF_BIT_B2 (LED , led); -SPRINTF_BIT_B2 (SND , snd); -SPRINTF_BIT_B2 (FF , ff); -SPRINTF_BIT_B2 (SW , sw); +SPRINTF_BIT (EV , ev); +TEST_AND_SPRINTF_BIT (KEY , key); +TEST_AND_SPRINTF_BIT (REL , rel); +TEST_AND_SPRINTF_BIT (ABS , abs); +TEST_AND_SPRINTF_BIT (MSC , msc); +TEST_AND_SPRINTF_BIT (LED , led); +TEST_AND_SPRINTF_BIT (SND , snd); +TEST_AND_SPRINTF_BIT (FF , ff); +TEST_AND_SPRINTF_BIT (SW , sw); len +=sprintf (buf + len,"\n" );
@@ -689,7 +570,7 @@ static struct attribute_group input_dev_ static ssize_t input_dev_show_cap_##bm(struct class_device *dev, char *buf) \ { \ struct input_dev *input_dev = to_input_dev(dev); \ - return input_print_bitmap(buf, input_dev->bm##bit, ev##_MAX); \ + return input_print_bitmap(buf, PAGE_SIZE, input_dev->bm##bit, ev##_MAX);\ } \ static CLASS_DEVICE_ATTR(bm, S_IRUGO, input_dev_show_cap_##bm, NULL);
@@ -729,9 +610,95 @@ static void input_dev_release(struct clamodule_put (THIS_MODULE ); } +/* +* Input hotplugging interface - loading event handlers based on +* device bitfields. +*/ +static int input_add_hotplug_bm_var (char **envp,int num_envp,int *cur_index, +char *buffer,int buffer_size,int *cur_len, +const char *name,unsigned long *bitmap,int max) +{ +if (*cur_index >= num_envp -1 ) +return -ENOMEM ; + + envp[*cur_index] = buffer + *cur_len; + + *cur_len +=snprintf (buffer + *cur_len,max (buffer_size - *cur_len,0 ), name); +if (*cur_len > buffer_size) +return -ENOMEM ; + + *cur_len +=input_print_bitmap (buffer + *cur_len, +max (buffer_size - *cur_len,0 ), + bitmap, max) +1 ; +if (*cur_len > buffer_size) +return -ENOMEM ; + + (*cur_index)++; +return 0 ; +} + +#define INPUT_ADD_HOTPLUG_VAR(fmt, val...) \ + do { \ + int err = add_hotplug_env_var(envp, num_envp, &i, \ + buffer, buffer_size, &len, \ + fmt, val); \ + if (err) \ + return err; \ + } while (0) + +#define INPUT_ADD_HOTPLUG_BM_VAR (name, bm, max) \ + do { \ + int err = input_add_hotplug_bm_var(envp, num_envp, &i, \ + buffer, buffer_size, &len, \ + name, bm, max); \ + if (err) \ + return err; \ + } while (0) + +static int input_dev_hotplug (struct class_device *cdev,char **envp, +int num_envp,char *buffer,int buffer_size) +{ +struct input_dev *dev =to_input_dev (cdev); +int i =0 ; +int len =0 ; + +INPUT_ADD_HOTPLUG_VAR ("PRODUCT=%x/%x/%x/%x" , + dev->id.bustype, dev->id.vendor, + dev->id.product, dev->id.version); +if (dev->name) +INPUT_ADD_HOTPLUG_VAR ("NAME=\"%s\"" , dev->name); +if (dev->phys) +INPUT_ADD_HOTPLUG_VAR ("PHYS=\"%s\"" , dev->phys); +if (dev->phys) +INPUT_ADD_HOTPLUG_VAR ("UNIQ=\"%s\"" , dev->uniq); + +INPUT_ADD_HOTPLUG_BM_VAR ("EV=" , dev->evbit,EV_MAX ); +if (test_bit (EV_KEY , dev->evbit)) +INPUT_ADD_HOTPLUG_BM_VAR ("KEY=" , dev->keybit,KEY_MAX ); +if (test_bit (EV_REL , dev->evbit)) +INPUT_ADD_HOTPLUG_BM_VAR ("REL=" , dev->relbit,REL_MAX ); +if (test_bit (EV_ABS , dev->evbit)) +INPUT_ADD_HOTPLUG_BM_VAR ("ABS=" , dev->absbit,ABS_MAX ); +if (test_bit (EV_MSC , dev->evbit)) +INPUT_ADD_HOTPLUG_BM_VAR ("MSC=" , dev->mscbit,MSC_MAX ); +if (test_bit (EV_LED , dev->evbit)) +INPUT_ADD_HOTPLUG_BM_VAR ("LED=" , dev->ledbit,LED_MAX ); +if (test_bit (EV_SND , dev->evbit)) +INPUT_ADD_HOTPLUG_BM_VAR ("SND=" , dev->sndbit,SND_MAX ); +if (test_bit (EV_FF , dev->evbit)) +INPUT_ADD_HOTPLUG_BM_VAR ("FF=" , dev->ffbit,FF_MAX ); +if (test_bit (EV_SW , dev->evbit)) +INPUT_ADD_HOTPLUG_BM_VAR ("SW=" , dev->swbit,SW_MAX ); + + envp[i] =NULL ; + +return 0 ; +} +struct class input_class = { .name ="input" , .release = input_dev_release, + .hotplug = input_dev_hotplug, };struct input_dev *input_allocate_device (void )
@@ -810,10 +777,6 @@ void input_register_device(struct input_input_link_handle (handle); -#ifdef CONFIG_HOTPLUG -input_call_hotplug ("add" , dev); -#endif -input_wakeup_procfs_readers (); }
@@ -832,10 +795,6 @@ void input_unregister_device(struct inpu handle->handler->disconnect (handle); } -#ifdef CONFIG_HOTPLUG -input_call_hotplug ("remove" , dev); -#endif -list_del_init (&dev->node);if (dev->dynalloc) {
PATCH 1/1 INPUT: rename input_dev_class to input_class to be correct.
In reply to Greg KH[PATCH] INPUT: rename input_dev_class to input_class to be correct.
---
commit fdbb989037a62b1748fdf3e292601a9373fa0739
tree f31cc114d1acdf13b3099ca1d83d5a5808c5e2ee
parent 4fccc75dab34abbbf9368d2fa21bed0918cdaec7
author Greg Kroah-Hartman <[email protected]> Thu, 27 Oct 2005 22:25:43 -0700 committer Greg Kroah-Hartman <[email protected]> Thu, 27 Oct 2005 22:48:06 -0700
drivers/input/evdev.c | 4 ++-- drivers/input/input.c | 14 +++++++------- drivers/input/joydev.c | 4 ++-- drivers/input/mousedev.c | 8 ++++---- drivers/input/tsdev.c | 4 ++-- include/linux/input.h | 2 +- 6 files changed, 18 insertions(+), 18 deletions(-)
drivers/input/evdev.c +2 -2
@@ -686,7 +686,7 @@ static struct input_handle *evdev_connec evdev_table[minor] = evdev; -class_device_create (&input_dev_class, &dev->cdev, +class_device_create (&input_class, &dev->cdev,MKDEV (INPUT_MAJOR ,EVDEV_MINOR_BASE + minor), dev->cdev.dev,"event%d" , minor);
@@ -698,7 +698,7 @@ static void evdev_disconnect(struct inpustruct evdev *evdev = handle->private;struct evdev_list *list; -class_device_destroy (&input_dev_class, +class_device_destroy (&input_class,MKDEV (INPUT_MAJOR ,EVDEV_MINOR_BASE + evdev->minor)); evdev->exist =0 ;
drivers/input/input.c +7 -7
@@ -39,7 +39,7 @@ EXPORT_SYMBOL(input_close_device);EXPORT_SYMBOL (input_accept_process);EXPORT_SYMBOL (input_flush_device);EXPORT_SYMBOL (input_event); -EXPORT_SYMBOL_GPL (input_dev_class); +EXPORT_SYMBOL_GPL (input_class);#define INPUT_DEVICES 256
@@ -729,8 +729,8 @@ static void input_dev_release(struct clamodule_put (THIS_MODULE ); } -struct class input_dev_class = { - .name ="input_dev" , +struct class input_class = { + .name ="input" , .release = input_dev_release, };
@@ -741,7 +741,7 @@ struct input_dev *input_allocate_device( dev =kzalloc (sizeof (struct input_dev ),GFP_KERNEL );if (dev) { dev->dynalloc =1 ; - dev->cdev.class = &input_dev_class; + dev->cdev.class = &input_class;class_device_initialize (&dev->cdev);INIT_LIST_HEAD (&dev->h_list);INIT_LIST_HEAD (&dev->node);
@@ -930,7 +930,7 @@ static int __init input_init(void) {int err; - err =class_register (&input_dev_class); + err =class_register (&input_class);if (err) {printk (KERN_ERR "input: unable to register input_dev class\n" );return err;
@@ -949,7 +949,7 @@ static int __init input_init(void)return 0 ; fail2:input_proc_exit (); - fail1:class_unregister (&input_dev_class); + fail1:class_unregister (&input_class);return err; }
@@ -957,7 +957,7 @@ static void __exit input_exit(void) {input_proc_exit ();unregister_chrdev (INPUT_MAJOR ,"input" ); -class_unregister (&input_dev_class); +class_unregister (&input_class); }subsys_initcall (input_init);
drivers/input/joydev.c +2 -2
@@ -513,7 +513,7 @@ static struct input_handle *joydev_conne joydev_table[minor] = joydev; -class_device_create (&input_dev_class, &dev->cdev, +class_device_create (&input_class, &dev->cdev,MKDEV (INPUT_MAJOR ,JOYDEV_MINOR_BASE + minor), dev->cdev.dev,"js%d" , minor);
@@ -525,7 +525,7 @@ static void joydev_disconnect(struct inpstruct joydev *joydev = handle->private;struct joydev_list *list; -class_device_destroy (&input_dev_class,MKDEV (INPUT_MAJOR ,JOYDEV_MINOR_BASE + joydev->minor)); +class_device_destroy (&input_class,MKDEV (INPUT_MAJOR ,JOYDEV_MINOR_BASE + joydev->minor)); joydev->exist =0 ;if (joydev->open) {
drivers/input/mousedev.c +4 -4
@@ -648,7 +648,7 @@ static struct input_handle *mousedev_con mousedev_table[minor] = mousedev; -class_device_create (&input_dev_class, &dev->cdev, +class_device_create (&input_class, &dev->cdev,MKDEV (INPUT_MAJOR ,MOUSEDEV_MINOR_BASE + minor), dev->cdev.dev,"mouse%d" , minor);
@@ -660,7 +660,7 @@ static void mousedev_disconnect(struct istruct mousedev *mousedev = handle->private;struct mousedev_list *list; -class_device_destroy (&input_dev_class, +class_device_destroy (&input_class,MKDEV (INPUT_MAJOR ,MOUSEDEV_MINOR_BASE + mousedev->minor)); mousedev->exist =0 ;
@@ -734,7 +734,7 @@ static int __init mousedev_init(void) mousedev_mix.exist =1 ; mousedev_mix.minor =MOUSEDEV_MIX ; -class_device_create (&input_dev_class,NULL , +class_device_create (&input_class,NULL ,MKDEV (INPUT_MAJOR ,MOUSEDEV_MINOR_BASE +MOUSEDEV_MIX ),NULL ,"mice" );#ifdef CONFIG_INPUT_MOUSEDEV_PSAUX
@@ -753,7 +753,7 @@ static void __exit mousedev_exit(void)if (psaux_registered)misc_deregister (&psaux_mouse);#endif -class_device_destroy (&input_dev_class, +class_device_destroy (&input_class,MKDEV (INPUT_MAJOR ,MOUSEDEV_MINOR_BASE +MOUSEDEV_MIX ));input_unregister_handler (&mousedev_handler); }
drivers/input/tsdev.c +2 -2
@@ -409,7 +409,7 @@ static struct input_handle *tsdev_connec tsdev_table[minor] = tsdev; -class_device_create (&input_dev_class, &dev->cdev, +class_device_create (&input_class, &dev->cdev,MKDEV (INPUT_MAJOR ,TSDEV_MINOR_BASE + minor), dev->cdev.dev,"ts%d" , minor);
@@ -421,7 +421,7 @@ static void tsdev_disconnect(struct inpustruct tsdev *tsdev = handle->private;struct tsdev_list *list; -class_device_destroy (&input_dev_class, +class_device_destroy (&input_class,MKDEV (INPUT_MAJOR ,TSDEV_MINOR_BASE + tsdev->minor)); tsdev->exist =0 ;
include/linux/input.h +1 -1
@@ -1074,7 +1074,7 @@ static inline void input_set_abs_params( dev->absbit[LONG (axis)] |=BIT (axis); } -extern struct class input_dev_class; +extern struct class input_class;#endif #endif
PATCH 1/1 Input: show sysfs path in /proc/bus/input/devices
In reply to Greg KH[PATCH] Input: show sysfs path in /proc/bus/input/devices
Input: show sysfs path in /proc/bus/input/devices
Show that sysfs and phys path are different objects.
---
commit 2870664a166086db34c99dfa2fc15e881131b45b
tree 702481ec0d84499eb6eeceeb08483a61be70f54f
parent 5555c7bc942fff098f65b233d1a47b611a81e7bc
author Dmitry Torokhov <[email protected]> Thu, 15 Sep 2005 02:01:54 -0500 committer Greg Kroah-Hartman <[email protected]> Thu, 27 Oct 2005 22:48:06 -0700
drivers/input/input.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/input/input.c +6 -0
@@ -475,17 +475,21 @@ static int input_devices_read(char *buf, {struct input_dev *dev;struct input_handle *handle; +const char *path;off_t at =0 ;int i, len, cnt =0 ;list_for_each_entry (dev, &input_dev_list, node) { + path = dev->dynalloc ?kobject_get_path (&dev->cdev.kobj,GFP_KERNEL ) :NULL ; + len =sprintf (buf,"I: Bus=%04x Vendor=%04x Product=%04x Version=%04x\n" , dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version); len +=sprintf (buf + len,"N: Name=\"%s\"\n" , dev->name ? dev->name :"" ); len +=sprintf (buf + len,"P: Phys=%s\n" , dev->phys ? dev->phys :"" ); + len +=sprintf (buf + len,"S: Sysfs=%s\n" , path ? path :"" ); len +=sprintf (buf + len,"H: Handlers=" );list_for_each_entry (handle, &dev->h_list, d_node)
@@ -516,6 +520,8 @@ static int input_devices_read(char *buf,if (cnt >= count)break ; } + +kfree (path); }if (&dev->node == &input_dev_list)
PATCH 1/1 Driver Core: Big kfree NULL check cleanup - Documentation
In reply to Greg KH[PATCH] Driver Core: Big kfree NULL check cleanup - Documentation
This is the Documentation/ part of the big kfree cleanup patch.
Remove pointless checks for NULL prior to calling kfree() in example code in Documentation/.
---
commit c4438d593e764474d701af6deebbb7df567be40f
tree 437de4251803d433d3cb80cc72e3f8aa83efd233
parent c2458141eaa1fcfe3c09a9834784a2c2716012b3
author Jesper Juhl <[email protected]> Thu, 13 Oct 2005 21:31:08 +0200 committer Greg Kroah-Hartman <[email protected]> Thu, 27 Oct 2005 22:48:07 -0700
Documentation/DocBook/writing_usb_driver.tmpl | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
Documentation/DocBook/writing_usb_driver.tmpl +1 -2
@@ -345,8 +345,7 @@ if (!retval) { <programlisting> static inline void skel_delete (struct usb_skel *dev) { - if (dev->bulk_in_buffer != NULL) - kfree (dev->bulk_in_buffer); + kfree (dev->bulk_in_buffer); if (dev->bulk_out_buffer != NULL) usb_buffer_free (dev->udev, dev->bulk_out_size, dev->bulk_out_buffer,
PATCH 1/1 INPUT: remove the input_class structure, as it is unused.
In reply to Greg KH[PATCH] INPUT: remove the input_class structure, as it is unused.
---
commit 4fccc75dab34abbbf9368d2fa21bed0918cdaec7
tree aac77ee746bae2328684201596b2860d94fd1e02
parent 706d2a7c95014882307f31cd0f3c2a95b0544819
author Greg Kroah-Hartman <[email protected]> Thu, 27 Oct 2005 22:25:43 -0700 committer Greg Kroah-Hartman <[email protected]> Thu, 27 Oct 2005 22:48:06 -0700
drivers/input/input.c | 18 +++--------------- include/linux/input.h | 1 - 2 files changed, 3 insertions(+), 16 deletions(-)
drivers/input/input.c +3 -15
@@ -39,7 +39,6 @@ EXPORT_SYMBOL(input_close_device);EXPORT_SYMBOL (input_accept_process);EXPORT_SYMBOL (input_flush_device);EXPORT_SYMBOL (input_event); -EXPORT_SYMBOL (input_class);EXPORT_SYMBOL_GPL (input_dev_class);#define INPUT_DEVICES 256
@@ -927,8 +926,6 @@ static struct file_operations input_fops .open = input_open_file, }; -struct class *input_class; -static int __init input_init (void ) {int err;
@@ -939,27 +936,19 @@ static int __init input_init(void)return err; } - input_class =class_create (THIS_MODULE ,"input" ); -if (IS_ERR (input_class)) { -printk (KERN_ERR "input: unable to register input class\n" ); - err =PTR_ERR (input_class); - goto fail1; - } - err =input_proc_init ();if (err) - goto fail2; + goto fail1; err =register_chrdev (INPUT_MAJOR ,"input" , &input_fops);if (err) {printk (KERN_ERR "input: unable to register char major %d" ,INPUT_MAJOR ); - goto fail3; + goto fail2; }return 0 ; - fail3:input_proc_exit (); - fail2:class_destroy (input_class); + fail2:input_proc_exit (); fail1:class_unregister (&input_dev_class);return err; }
@@ -968,7 +957,6 @@ static void __exit input_exit(void) {input_proc_exit ();unregister_chrdev (INPUT_MAJOR ,"input" ); -class_destroy (input_class);class_unregister (&input_dev_class); }
include/linux/input.h +0 -1
@@ -1074,7 +1074,6 @@ static inline void input_set_abs_params( dev->absbit[LONG(axis)] |= BIT(axis); } -extern struct class *input_class;extern struct class input_dev_class;#endif
PATCH 1/1 INPUT: export input_dev_class so that input drivers can use it.
[PATCH] INPUT: export input_dev_class so that input drivers can use it.
---
commit 67f440c4cac8a7073e113a0a7f201089123772a0
tree d7c2ac72d8a55945918ae8347ceb814cb7eacaa5
parent 9c507854ead3fc14687b2402618b53ce4cea934a
author Greg Kroah-Hartman <[email protected]> Thu, 27 Oct 2005 22:25:43 -0700 committer Greg Kroah-Hartman <[email protected]> Thu, 27 Oct 2005 22:48:06 -0700
drivers/input/input.c | 3 ++- include/linux/input.h | 1 + 2 files changed, 3 insertions(+), 1 deletions(-)
drivers/input/input.c +2 -1
@@ -40,6 +40,7 @@ EXPORT_SYMBOL(input_accept_process);EXPORT_SYMBOL (input_flush_device);EXPORT_SYMBOL (input_event);EXPORT_SYMBOL (input_class); +EXPORT_SYMBOL_GPL (input_dev_class);#define INPUT_DEVICES 256
@@ -724,7 +725,7 @@ static void input_dev_release(struct clamodule_put (THIS_MODULE ); } -static struct class input_dev_class = { +struct class input_dev_class = { .name ="input_dev" , .release = input_dev_release, .class_dev_attrs = input_dev_attrs,
include/linux/input.h +1 -0
@@ -1075,6 +1075,7 @@ static inline void input_set_abs_params( }extern struct class *input_class; +extern struct class input_dev_class;#endif #endif
PATCH 1/1 INPUT: Fix oops when accessing sysfs files of nested input devices
[PATCH] INPUT: Fix oops when accessing sysfs files of nested input devices
---
commit 706d2a7c95014882307f31cd0f3c2a95b0544819
tree d13cecf9467ec8812058bad516c451e1d2c7263e
parent ae2ea92c4fa1b32ab686bf48243b3671b3aa7c3a
author Greg Kroah-Hartman <[email protected]> Thu, 27 Oct 2005 22:25:43 -0700 committer Greg Kroah-Hartman <[email protected]> Thu, 27 Oct 2005 22:48:06 -0700
drivers/input/input.c | 19 ++++++++++++------- 1 files changed, 12 insertions(+), 7 deletions(-)
drivers/input/input.c +12 -7
@@ -642,17 +642,22 @@ static ssize_t input_dev_show_##name(strup (&input_dev->sem); \ \return retval; \ -} +} \ +static CLASS_DEVICE_ATTR(name, S_IRUGO, input_dev_show_##name, NULL);INPUT_DEV_STRING_ATTR_SHOW (name);INPUT_DEV_STRING_ATTR_SHOW (phys);INPUT_DEV_STRING_ATTR_SHOW (uniq); -static struct class_device_attribute input_dev_attrs[] = { -__ATTR (name,S_IRUGO , input_dev_show_name,NULL ), -__ATTR (phys,S_IRUGO , input_dev_show_phys,NULL ), -__ATTR (uniq,S_IRUGO , input_dev_show_uniq,NULL ), - __ATTR_NULL +static struct attribute *input_dev_attrs[] = { + &class_device_attr_name.attr, + &class_device_attr_phys.attr, + &class_device_attr_uniq.attr, +NULL +}; + +static struct attribute_group input_dev_group = { + .attrs = input_dev_attrs, };#define INPUT_DEV_ID_ATTR (name) \
@@ -728,7 +733,6 @@ static void input_dev_release(struct clastruct class input_dev_class = { .name ="input_dev" , .release = input_dev_release, - .class_dev_attrs = input_dev_attrs, };struct input_dev *input_allocate_device (void )
@@ -766,6 +770,7 @@ static void input_register_classdevice(skfree (path);class_device_add (&dev->cdev); +sysfs_create_group (&dev->cdev.kobj, &input_dev_group);sysfs_create_group (&dev->cdev.kobj, &input_dev_id_attr_group);sysfs_create_group (&dev->cdev.kobj, &input_dev_caps_attr_group); }
PATCH 1/1 drivers/base - fix sparse warnings
In reply to Greg KH[PATCH] drivers/base - fix sparse warnings
There are a number of sparse warnings from the latest sparse snapshot being generated from the drivers/base build. The main culprits are due to the initialisation functions not being declared in a header file.
Also, the firmware.c file should include <linux/device.h> to get the prototype of firmware_register() and firmware_unregister().
This patch moves the init function declerations from the init.c file to the base.h, and ensures it is included in all the relevant c sources. It also adds <linux/device.h> to the included headers for firmware.c.
The patch does not solve all the sparse errors generated, but reduces the count significantly.
drivers/base/core.c:161:1: warning: symbol 'devices_subsys' was not declared. Should it be static? drivers/base/core.c:417:12: warning: symbol 'devices_init' was not declared. Should it be static? drivers/base/sys.c:253:6: warning: symbol 'sysdev_shutdown' was not declared. Should it be static? drivers/base/sys.c:326:5: warning: symbol 'sysdev_suspend' was not declared. Should it be static? drivers/base/sys.c:428:5: warning: symbol 'sysdev_resume' was not declared. Should it be static? drivers/base/sys.c:450:12: warning: symbol 'system_bus_init' was not declared. Should it be static? drivers/base/bus.c:133:1: warning: symbol 'bus_subsys' was not declared. Should it be static? drivers/base/bus.c:667:12: warning: symbol 'buses_init' was not declared. Should it be static? drivers/base/class.c:759:12: warning: symbol 'classes_init' was not declared. Should it be static? drivers/base/platform.c:313:12: warning: symbol 'platform_bus_init' was not declared. Should it be static? drivers/base/cpu.c:110:12: warning: symbol 'cpu_dev_init' was not declared. Should it be static? drivers/base/firmware.c:17:5: warning: symbol 'firmware_register' was not declared. Should it be static? drivers/base/firmware.c:23:6: warning: symbol 'firmware_unregister' was not declared. Should it be static? drivers/base/firmware.c:28:12: warning: symbol 'firmware_init' was not declared. Should it be static? drivers/base/init.c:28:13: warning: symbol 'driver_init' was not declared. Should it be static? drivers/base/dmapool.c:174:10: warning: implicit cast from nocast type drivers/base/attribute_container.c:439:1: warning: symbol 'attribute_container_init' was not declared. Should it be static? drivers/base/power/runtime.c:76:6: warning: symbol 'dpm_set_power_state' was not declared. Should it be static?
---
commit e9821c685cbf2d72f6d692117e83ff9b71c3315b
tree dd96f48d3337746850b8c382aa71410036a3d519
parent 104d94a7ef01bb62f2be1d59c7580c1a6f3478d5
author Ben Dooks <[email protected]> Thu, 13 Oct 2005 17:54:41 +0100 committer Greg Kroah-Hartman <[email protected]> Thu, 27 Oct 2005 22:48:07 -0700
drivers/base/attribute_container.c | 2 ++ drivers/base/base.h | 12 ++++++++++++ drivers/base/cpu.c | 1 + drivers/base/firmware.c | 3 +++ drivers/base/init.c | 10 ++-------- drivers/base/platform.c | 2 ++ 6 files changed, 22 insertions(+), 8 deletions(-)
drivers/base/attribute_container.c +2 -0
@@ -19,6 +19,8 @@#include <linux/list.h> #include <linux/module.h> +#include "base.h" +/* This is a private structure used to tie the classdev and the * container .. it should never be visible outside this file */ struct internal_container {
drivers/base/base.h +12 -0
@@ -1,3 +1,15 @@ + +/* initialisation functions */ + +extern int devices_init (void ); +extern int buses_init (void ); +extern int classes_init (void ); +extern int firmware_init (void ); +extern int platform_bus_init (void ); +extern int system_bus_init (void ); +extern int cpu_dev_init (void ); +extern int attribute_container_init (void ); +extern int bus_add_device (struct device * dev);extern void bus_remove_device (struct device * dev);
drivers/base/cpu.c +1 -0
@@ -9,6 +9,7 @@#include <linux/topology.h> #include <linux/device.h> +#include "base.h" struct sysdev_class cpu_sysdev_class = {set_kset_name ("cpu" ),
drivers/base/firmware.c +3 -0
@@ -11,6 +11,9 @@#include <linux/kobject.h> #include <linux/module.h> #include <linux/init.h> +#include <linux/device.h> + +#include "base.h" static decl_subsys(firmware, NULL, NULL);
drivers/base/init.c +2 -8
@@ -10,14 +10,8 @@#include <linux/device.h> #include <linux/init.h> -extern int devices_init (void ); -extern int buses_init (void ); -extern int classes_init (void ); -extern int firmware_init (void ); -extern int platform_bus_init (void ); -extern int system_bus_init (void ); -extern int cpu_dev_init (void ); -extern int attribute_container_init (void ); +#include "base.h" +/** * driver_init - initialize driver model. *
drivers/base/platform.c +2 -0
@@ -17,6 +17,8 @@#include <linux/bootmem.h> #include <linux/err.h> +#include "base.h" +struct device platform_bus = { .bus_id ="platform" , };
Re: [PATCH] DRIVER MODEL: Get rid of the obsolete tri-level suspend/resume callbacks
In reply to Greg KHQuoted 8 lines · Greg KH
Signed-off-by Russell King <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>---
commitafe631e665d991c18e3e636b1c2455a891758760
treea5ee0e95290b40a8b35b1a33de7e9da5fb7df534
parentc4438d593e764474d701af6deebbb7df567be40f
author Russell King <[email protected]> Thu, 27 Oct 2005 22:48:09 -0700
Greg,
When you take patches from my git repository, please ensure that you preserve the author as is and don't use the first signed-off-by line.
Thanks.
Signature · 3 lines
Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of: 2.6 Serial core
Re: [PATCH] DRIVER MODEL: Get rid of the obsolete tri-level suspend/resume callbacks
In reply to Greg KHAt Thu, 27 Oct 2005 23:30:27 -0700,
Documentation/driver-model/driver.txt it into a supported low-power state. · line 198
Quoted 7 lines · Greg KH
Documentation/driver-model/driver.txt +0
-0@@ -196,67 +196,11 @@ it into a supported low-power state. int (*suspend) (struct device * dev, pm_message_t state, u32 level);
Shouldn't this be also changed without level argument?
Documentation/driver-model/driver.txt it into a supported low-power state. · line 202
Quoted 4 lines
Documentation/driver-model/driver.txt +1
-0+suspend is called to put the device in a low power state. int (*resume) (struct device * dev, u32 level);
Ditto.
Takashi
Re: [PATCH] DRIVER MODEL: Get rid of the obsolete tri-level suspend/resume callbacks
Quoted 13 lines · Takashi Iwai
At Thu, 27 Oct 2005 23:30:27 -0700,
Documentation/driver-model/driver.txt it into a supported low-power state. · line 198
Quoted 7 lines · Greg KH
Documentation/driver-model/driver.txt +0
-0@@ -196,67 +196,11 @@ it into a supported low-power state. int (*suspend) (struct device * dev, pm_message_t state, u32 level);Shouldn't this be also changed without level argument?
Quoted 6 lines
Documentation/driver-model/driver.txt it into a supported low-power state. · line 202
Quoted 4 lines
Documentation/driver-model/driver.txt +1
-0+suspend is called to put the device in a low power state. int (*resume) (struct device * dev, u32 level);Ditto.
Probably. Please send a patch.
Signature · 3 lines
Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of: 2.6 Serial core
Re: [PATCH] DRIVER MODEL: Get rid of the obsolete tri-level suspend/resume callbacks
At Fri, 28 Oct 2005 12:13:27 +0100,
Quoted 15 lines · Russell King
Quoted 13 lines · Takashi Iwai
At Thu, 27 Oct 2005 23:30:27 -0700,
Documentation/driver-model/driver.txt it into a supported low-power state. · line 198
Quoted 7 lines · Greg KH
Documentation/driver-model/driver.txt +0
-0@@ -196,67 +196,11 @@ it into a supported low-power state. int (*suspend) (struct device * dev, pm_message_t state, u32 level);Shouldn't this be also changed without level argument?
Quoted 8 lines
Quoted 6 lines
Documentation/driver-model/driver.txt it into a supported low-power state. · line 202
Quoted 4 lines
Documentation/driver-model/driver.txt +1
-0+suspend is called to put the device in a low power state. int (*resume) (struct device * dev, u32 level);Ditto.
Probably. Please send a patch.
OK, here we go:
[PATCH] Fix documentation of driver suspend/resume callbacks
---
Documentation/driver-model/driver.txt +4 -4
@@ -14,8 +14,8 @@ struct device_driver { int (*probe) (struct device * dev); int (*remove) (struct device * dev); - int (*suspend) (struct device * dev, pm_message_t state, u32 level); - int (*resume) (struct device * dev, u32 level); + int (*suspend) (struct device * dev, pm_message_t state); + int (*resume) (struct device * dev); };
@@ -194,11 +194,11 @@ device; i.e. anything in the device's dr If the device is still present, it should quiesce the device and place it into a supported low-power state. - int (*suspend) (struct device * dev, pm_message_t state, u32 level); + int (*suspend) (struct device * dev, pm_message_t state); suspend is called to put the device in a low power state. - int (*resume) (struct device * dev, u32 level); + int (*resume) (struct device * dev); Resume is used to bring a device back from a low power state.