CBUS Second try
cover CBUS Second try
Hi Tony,
here are the fixes for CBUS RETU.
Just one patch added, no other differences. My cbus branch has been updated for convenience:
git://gitorious.org/usb/usb.git cbus
(I'm starting to think usb.git isn't a good name for that tree)
Felipe Balbi (6):
cbus: retu: wdt: save dev in retu_wdt_dev
cbus: retu: pass the child device pointer to all retu functions
cbus: retu: headset: don't save pdev pointer
cbus: retu: replace EXPORT_SYMBOL with EXPORT_SYMBOL_GPL
cbus: retu: tabify retu initialization
cbus: retu: set pm_power_off to NULL when removing retu
drivers/cbus/retu-headset.c | 35 +++++++++++-------- drivers/cbus/retu-pwrbutton.c | 2 +- drivers/cbus/retu-rtc.c | 28 ++++++++-------- drivers/cbus/retu-wdt.c | 8 ++-- drivers/cbus/retu.c | 73 ++++++++++++++++++++++++---------------- drivers/cbus/retu.h | 9 +++-- 6 files changed, 88 insertions(+), 67 deletions(-)
Signature · 1 line
1.7.4.rc2
PATCH 2/6 cbus: retu: pass the child device pointer to all retu functions
Throught the child device pointer, we can fetch
our needed struct retu simply by dev_get_drvdata(child->parent)
By using that trick, we can get really close to getting rid of the global struct retu pointer.
--- drivers/cbus/retu-headset.c | 31 ++++++++++++++++++------------- drivers/cbus/retu-pwrbutton.c | 2 +- drivers/cbus/retu-rtc.c | 28 ++++++++++++++-------------- drivers/cbus/retu-wdt.c | 7 +++---- drivers/cbus/retu.c | 37 +++++++++++++++++++++++++++---------- drivers/cbus/retu.h | 9 +++++---- 6 files changed, 68 insertions(+), 46 deletions(-)
drivers/cbus/retu-headset.c +18 -13
@@ -48,15 +48,16 @@ struct retu_headset {int irq; }; -static void retu_headset_set_bias (int enable) +static void retu_headset_set_bias (struct retu_headset *hs,int enable) {if (enable) { -retu_set_clear_reg_bits (RETU_REG_AUDTXR , +retu_set_clear_reg_bits (&hs->pdev->dev,RETU_REG_AUDTXR , (1 <<0 ) | (1 <<1 ),0 );msleep (2 ); -retu_set_clear_reg_bits (RETU_REG_AUDTXR ,1 <<3 ,0 ); +retu_set_clear_reg_bits (&hs->pdev->dev,RETU_REG_AUDTXR , +1 <<3 ,0 ); }else { -retu_set_clear_reg_bits (RETU_REG_AUDTXR ,0 , +retu_set_clear_reg_bits (&hs->pdev->dev,RETU_REG_AUDTXR ,0 , (1 <<0 ) | (1 <<1 ) | (1 <<3 )); } }
@@ -66,7 +67,7 @@ static void retu_headset_enable(struct retu_headset *hs)mutex_lock (&hs->mutex);if (!hs->bias_enabled) { hs->bias_enabled =1 ; -retu_headset_set_bias (1 ); +retu_headset_set_bias (hs,1 ); }mutex_unlock (&hs->mutex); }
@@ -76,7 +77,7 @@ static void retu_headset_disable(struct retu_headset *hs)mutex_lock (&hs->mutex);if (hs->bias_enabled) { hs->bias_enabled =0 ; -retu_headset_set_bias (0 ); +retu_headset_set_bias (hs,0 ); }mutex_unlock (&hs->mutex); }
@@ -86,7 +87,8 @@ static void retu_headset_det_enable(struct retu_headset *hs)mutex_lock (&hs->mutex);if (!hs->detection_enabled) { hs->detection_enabled =1 ; -retu_set_clear_reg_bits (RETU_REG_CC1 , (1 <<10 ) | (1 <<8 ),0 ); +retu_set_clear_reg_bits (&hs->pdev->dev,RETU_REG_CC1 , + (1 <<10 ) | (1 <<8 ),0 ); }mutex_unlock (&hs->mutex); }
@@ -104,7 +106,8 @@ static void retu_headset_det_disable(struct retu_headset *hs)if (hs->pressed)input_report_key (hs->idev,RETU_HEADSET_KEY ,0 );spin_unlock_irqrestore (&hs->lock, flags); -retu_set_clear_reg_bits (RETU_REG_CC1 ,0 , (1 <<10 ) | (1 <<8 )); +retu_set_clear_reg_bits (&hs->pdev->dev,RETU_REG_CC1 ,0 , + (1 <<10 ) | (1 <<8 )); }mutex_unlock (&hs->mutex); }
@@ -115,7 +118,7 @@ static ssize_t retu_headset_hookdet_show(struct device *dev, {int val; - val =retu_read_adc (RETU_ADC_CHANNEL_HOOKDET ); + val =retu_read_adc (dev,RETU_ADC_CHANNEL_HOOKDET );return sprintf (buf,"%d\n" , val); }
@@ -190,7 +193,8 @@ static irqreturn_t retu_headset_hook_interrupt(int irq, void *_hs)input_report_key (hs->idev,RETU_HEADSET_KEY ,1 ); }spin_unlock_irqrestore (&hs->lock, flags); -retu_set_clear_reg_bits (RETU_REG_CC1 ,0 , (1 <<10 ) | (1 <<8 )); +retu_set_clear_reg_bits (&hs->pdev->dev,RETU_REG_CC1 ,0 , + (1 <<10 ) | (1 <<8 ));mod_timer (&hs->enable_timer, jiffies +msecs_to_jiffies (50 ));return IRQ_HANDLED ;
@@ -200,7 +204,8 @@ static void retu_headset_enable_timer(unsigned long arg) {struct retu_headset *hs = (struct retu_headset *) arg; -retu_set_clear_reg_bits (RETU_REG_CC1 , (1 <<10 ) | (1 <<8 ),0 ); +retu_set_clear_reg_bits (&hs->pdev->dev,RETU_REG_CC1 , + (1 <<10 ) | (1 <<8 ),0 );mod_timer (&hs->detect_timer, jiffies +msecs_to_jiffies (350 )); }
@@ -309,7 +314,7 @@ static int retu_headset_suspend(struct platform_device *pdev,mutex_lock (&hs->mutex);if (hs->bias_enabled) -retu_headset_set_bias (0 ); +retu_headset_set_bias (hs,0 );mutex_unlock (&hs->mutex);return 0 ;
@@ -321,7 +326,7 @@ static int retu_headset_resume(struct platform_device *pdev)mutex_lock (&hs->mutex);if (hs->bias_enabled) -retu_headset_set_bias (1 ); +retu_headset_set_bias (hs,1 );mutex_unlock (&hs->mutex);return 0 ;
drivers/cbus/retu-pwrbutton.c +1 -1
@@ -58,7 +58,7 @@ static irqreturn_t retubutton_irq(int irq, void *_pwr)struct retu_pwrbutton *pwr = _pwr;int state; -if (retu_read_reg (RETU_REG_STATUS ) &RETU_STATUS_PWRONX ) +if (retu_read_reg (pwr->dev,RETU_REG_STATUS ) &RETU_STATUS_PWRONX ) state =PWRBTN_UP ;else state =PWRBTN_PRESSED ;
drivers/cbus/retu-rtc.c +14 -14
@@ -60,16 +60,16 @@ static void retu_rtc_do_reset(struct retu_rtc *rtc) {u16 ccr1; - ccr1 =retu_read_reg (RETU_REG_CC1 ); + ccr1 =retu_read_reg (rtc->dev,RETU_REG_CC1 );/* RTC in reset */ -retu_write_reg (RETU_REG_CC1 , ccr1 |0x0001 ); +retu_write_reg (rtc->dev,RETU_REG_CC1 , ccr1 |0x0001 );/* RTC in normal operating mode */ -retu_write_reg (RETU_REG_CC1 , ccr1 & ~0x0001 ); +retu_write_reg (rtc->dev,RETU_REG_CC1 , ccr1 & ~0x0001 );/* Disable alarm and RTC WD */ -retu_write_reg (RETU_REG_RTCHMAR ,0x7f3f ); +retu_write_reg (rtc->dev,RETU_REG_RTCHMAR ,0x7f3f );/* Set Calibration register to default value */ -retu_write_reg (RETU_REG_RTCCALR ,0x00c0 ); +retu_write_reg (rtc->dev,RETU_REG_RTCCALR ,0x00c0 ); rtc->alarm_expired =0 ; }
@@ -80,7 +80,7 @@ static irqreturn_t retu_rtc_interrupt(int irq, void *_rtc)mutex_lock (&rtc->mutex); rtc->alarm_expired =1 ; -retu_write_reg (RETU_REG_RTCHMAR , (24 <<8 ) |60 ); +retu_write_reg (rtc->dev,RETU_REG_RTCHMAR , (24 <<8 ) |60 );mutex_unlock (&rtc->mutex);return IRQ_HANDLED ;
@@ -120,7 +120,7 @@ static int retu_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)mutex_lock (&rtc->mutex); chmar = ((alm->time.tm_hour &0x1f ) <<8 ) | (alm->time.tm_min &0x3f ); -retu_write_reg (RETU_REG_RTCHMAR , chmar); +retu_write_reg (rtc->dev,RETU_REG_RTCHMAR , chmar);mutex_unlock (&rtc->mutex);
@@ -134,7 +134,7 @@ static int retu_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)mutex_lock (&rtc->mutex); - chmar =retu_read_reg (RETU_REG_RTCHMAR ); + chmar =retu_read_reg (rtc->dev,RETU_REG_RTCHMAR ); alm->time.tm_hour = (chmar >>8 ) &0x1f ; alm->time.tm_min = chmar &0x3f ;
@@ -156,8 +156,8 @@ static int retu_rtc_set_time(struct device *dev, struct rtc_time *tm)mutex_lock (&rtc->mutex); -retu_write_reg (RETU_REG_RTCDSR , dsr); -retu_write_reg (RETU_REG_RTCHMR , hmr); +retu_write_reg (rtc->dev,RETU_REG_RTCDSR , dsr); +retu_write_reg (rtc->dev,RETU_REG_RTCHMR , hmr);mutex_unlock (&rtc->mutex);
@@ -179,8 +179,8 @@ static int retu_rtc_read_time(struct device *dev, struct rtc_time *tm)mutex_lock (&rtc->mutex); - dsr =retu_read_reg (RETU_REG_RTCDSR ); - hmr =retu_read_reg (RETU_REG_RTCHMR ); + dsr =retu_read_reg (rtc->dev,RETU_REG_RTCDSR ); + hmr =retu_read_reg (rtc->dev,RETU_REG_RTCHMR ); tm->tm_sec = hmr &0xff ; tm->tm_min = hmr >>8 ;
@@ -215,7 +215,7 @@ static int __init retu_rtc_probe(struct platform_device *pdev)platform_set_drvdata (pdev, rtc);mutex_init (&rtc->mutex); - rtc->alarm_expired =retu_read_reg (RETU_REG_IDR ) & + rtc->alarm_expired =retu_read_reg (rtc->dev,RETU_REG_IDR ) & (0x1 <<RETU_INT_RTCA ); r =retu_rtc_init_irq (rtc);
@@ -225,7 +225,7 @@ static int __init retu_rtc_probe(struct platform_device *pdev) }/* If the calibration register is zero, we've probably lost power */ -if (!(retu_read_reg (RETU_REG_RTCCALR ) &0x00ff )) +if (!(retu_read_reg (rtc->dev,RETU_REG_RTCCALR ) &0x00ff ))retu_rtc_do_reset (rtc); rtc->rtc = rtc_device_register(pdev->name, &pdev->dev, &
drivers/cbus/retu-wdt.c +3 -4
@@ -67,7 +67,8 @@ static void retu_wdt_set_ping_timer(unsigned long enable);static int _retu_modify_counter (unsigned int new) { -retu_write_reg (RETU_REG_WATCHDOG , (u16 )new); +if (retu_wdt) +retu_write_reg (retu_wdt->dev,RETU_REG_WATCHDOG , (u16 )new);return 0 ; }
@@ -125,7 +126,7 @@ static ssize_t retu_wdt_counter_show(struct device *dev,u16 counter;/* Show current value in watchdog counter */ - counter =retu_read_reg (RETU_REG_WATCHDOG ); + counter =retu_read_reg (dev,RETU_REG_WATCHDOG );/* Only the 5 LSB are important */ return snprintf (buf,PAGE_SIZE ,"%u\n" , (counter &0x3F ));
@@ -228,8 +229,6 @@ static long retu_wdt_ioctl(struct file *file, unsigned int cmd,/* Start kicking retu watchdog until user space starts doing the kicking */ static int __devinit retu_wdt_ping (void ) { -int r; -#ifdef CONFIG_WATCHDOG_NOWAYOUT retu_modify_counter (RETU_WDT_MAX_TIMER );#else
drivers/cbus/retu.c +27 -10
@@ -95,34 +95,46 @@ static void __retu_write_reg(struct retu *retu, unsigned reg, u16 val)/** * retu_read_reg - Read a value from a register in Retu +* @child: device pointer for the calling child * @reg: the register to read from * * This function returns the contents of the specified register */ -int retu_read_reg (unsigned reg) +int retu_read_reg (struct device *child,unsigned reg) { -WARN (!the_retu,"Retu not initialized\n" ); -return __retu_read_reg (the_retu, reg); +struct retu *retu =dev_get_drvdata (child->parent); + +return __retu_read_reg (retu, reg); }EXPORT_SYMBOL (retu_read_reg);/** * retu_write_reg - Write a value to a register in Retu +* @child: the pointer to our calling child * @reg: the register to write to * @val: the value to write to the register * * This function writes a value to the specified register */ -void retu_write_reg (unsigned reg,u16 val) +void retu_write_reg (struct device *child,unsigned reg,u16 val) { -WARN (!the_retu,"Retu not initialized\n" ); -__retu_write_reg (the_retu, reg, val); +struct retu *retu =dev_get_drvdata (child->parent); + +__retu_write_reg (retu, reg, val); }EXPORT_SYMBOL (retu_write_reg); -void retu_set_clear_reg_bits (unsigned reg,u16 set,u16 clear) +/** +* retu_set_clear_reg_bits - helper function to read/set/clear bits +* @child: device pointer to calling child +* @reg: the register address +* @set: mask for setting bits +* @clear: mask for clearing bits +*/ +void retu_set_clear_reg_bits (struct device *child,unsigned reg,u16 set, +u16 clear) { -struct retu *retu = the_retu; +struct retu *retu =dev_get_drvdata (child->parent);u16 w;mutex_lock (&retu->mutex);
@@ -136,9 +148,14 @@ EXPORT_SYMBOL_GPL(retu_set_clear_reg_bits);#define ADC_MAX_CHAN_NUMBER 13 -int retu_read_adc (int channel) +/** +* retu_read_adc - Reads AD conversion result +* @child: device pointer to calling child +* @channel: the ADC channel to read from +*/ +int retu_read_adc (struct device *child,int channel) { -struct retu *retu = the_retu; +struct retu *retu =dev_get_drvdata (child->parent);int res;if (!retu)
drivers/cbus/retu.h +5 -4
@@ -57,9 +57,10 @@#define MAX_RETU_IRQ_HANDLERS 16 -int retu_read_reg (unsigned reg); -void retu_write_reg (unsigned reg,u16 val); -void retu_set_clear_reg_bits (unsigned reg,u16 set,u16 clear); -int retu_read_adc (int channel); +int retu_read_reg (struct device *child,unsigned reg); +void retu_write_reg (struct device *child,unsigned reg,u16 val); +void retu_set_clear_reg_bits (struct device *child,unsigned reg,u16 set, +u16 clear); +int retu_read_adc (struct device *child,int channel);#endif /* __DRIVERS_CBUS_RETU_H */
Signature · 1 line
1.7.4.rc2
PATCH 3/6 cbus: retu: headset: don't save pdev pointer
In reply to Felipe Balbi... and save instead a device pointer. Generally
we only need a device pointer as we don't need
to poke with the platform_device that often and
if we do, we can always to_platform_device(dev).
Drop the pdev from the headset structure and
save dev instead.
--- drivers/cbus/retu-headset.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-)
drivers/cbus/retu-headset.c +9 -9
@@ -38,7 +38,7 @@struct retu_headset {spinlock_t lock;struct mutex mutex; -struct platform_device *pdev; +struct device *dev;struct input_dev *idev;unsigned bias_enabled;unsigned detection_enabled;
@@ -51,13 +51,13 @@ struct retu_headset {static void retu_headset_set_bias (struct retu_headset *hs,int enable) {if (enable) { -retu_set_clear_reg_bits (&hs->pdev->dev,RETU_REG_AUDTXR , +retu_set_clear_reg_bits (hs->dev,RETU_REG_AUDTXR , (1 <<0 ) | (1 <<1 ),0 );msleep (2 ); -retu_set_clear_reg_bits (&hs->pdev->dev,RETU_REG_AUDTXR , +retu_set_clear_reg_bits (hs->dev,RETU_REG_AUDTXR ,1 <<3 ,0 ); }else { -retu_set_clear_reg_bits (&hs->pdev->dev,RETU_REG_AUDTXR ,0 , +retu_set_clear_reg_bits (hs->dev,RETU_REG_AUDTXR ,0 , (1 <<0 ) | (1 <<1 ) | (1 <<3 )); } }
@@ -87,7 +87,7 @@ static void retu_headset_det_enable(struct retu_headset *hs)mutex_lock (&hs->mutex);if (!hs->detection_enabled) { hs->detection_enabled =1 ; -retu_set_clear_reg_bits (&hs->pdev->dev,RETU_REG_CC1 , +retu_set_clear_reg_bits (hs->dev,RETU_REG_CC1 , (1 <<10 ) | (1 <<8 ),0 ); }mutex_unlock (&hs->mutex);
@@ -106,7 +106,7 @@ static void retu_headset_det_disable(struct retu_headset *hs)if (hs->pressed)input_report_key (hs->idev,RETU_HEADSET_KEY ,0 );spin_unlock_irqrestore (&hs->lock, flags); -retu_set_clear_reg_bits (&hs->pdev->dev,RETU_REG_CC1 ,0 , +retu_set_clear_reg_bits (hs->dev,RETU_REG_CC1 ,0 , (1 <<10 ) | (1 <<8 )); }mutex_unlock (&hs->mutex);
@@ -193,7 +193,7 @@ static irqreturn_t retu_headset_hook_interrupt(int irq, void *_hs)input_report_key (hs->idev,RETU_HEADSET_KEY ,1 ); }spin_unlock_irqrestore (&hs->lock, flags); -retu_set_clear_reg_bits (&hs->pdev->dev,RETU_REG_CC1 ,0 , +retu_set_clear_reg_bits (hs->dev,RETU_REG_CC1 ,0 , (1 <<10 ) | (1 <<8 ));mod_timer (&hs->enable_timer, jiffies +msecs_to_jiffies (50 ));
@@ -204,7 +204,7 @@ static void retu_headset_enable_timer(unsigned long arg) {struct retu_headset *hs = (struct retu_headset *) arg; -retu_set_clear_reg_bits (&hs->pdev->dev,RETU_REG_CC1 , +retu_set_clear_reg_bits (hs->dev,RETU_REG_CC1 , (1 <<10 ) | (1 <<8 ),0 );mod_timer (&hs->detect_timer, jiffies +msecs_to_jiffies (350 )); }
@@ -232,7 +232,7 @@ static int __init retu_headset_probe(struct platform_device *pdev)if (hs ==NULL )return -ENOMEM ; - hs->pdev = pdev; + hs->dev = &pdev->dev; hs->idev =input_allocate_device ();if (hs->idev ==NULL ) {
Signature · 1 line
1.7.4.rc2
PATCH 1/6 cbus: retu: wdt: save dev in retu_wdt_dev
In reply to Felipe Balbicommit 6b8074b00d90b191227dc875b90b272c51f7d6eb (cbus: Make retu watchdog behave like a standard Linux watchdog) introduced struct retu_wdt_dev with a field to save struct device *dev, but never got the point of saving the pointer into that structure.
Fix this very old bug so we can actually start passing child device pointers to retu read/write operations.
--- drivers/cbus/retu-wdt.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/cbus/retu-wdt.c +1 -0
@@ -258,6 +258,7 @@ static int __init retu_wdt_probe(struct platform_device *pdev)if (!wdev)return -ENOMEM ; + wdev->dev = &pdev->dev; wdev->users =0 ; ret =device_create_file (&pdev->dev, &dev_attr_period);
Signature · 1 line
1.7.4.rc2
PATCH 4/6 cbus: retu: replace EXPORT_SYMBOL with EXPORT_SYMBOL_GPL
In reply to Felipe BalbiWe don't want non-GPL retu children, so force
all exported symbols to be GPL-only.
--- drivers/cbus/retu.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/cbus/retu.c +3 -3
@@ -106,7 +106,7 @@ int retu_read_reg(struct device *child, unsigned reg)return __retu_read_reg (retu, reg); } -EXPORT_SYMBOL (retu_read_reg); +EXPORT_SYMBOL_GPL (retu_read_reg);/** * retu_write_reg - Write a value to a register in Retu
@@ -122,7 +122,7 @@ void retu_write_reg(struct device *child, unsigned reg, u16 val)__retu_write_reg (retu, reg, val); } -EXPORT_SYMBOL (retu_write_reg); +EXPORT_SYMBOL_GPL (retu_write_reg);/** * retu_set_clear_reg_bits - helper function to read/set/clear bits
@@ -185,7 +185,7 @@ int retu_read_adc(struct device *child, int channel)return res; } -EXPORT_SYMBOL (retu_read_adc); +EXPORT_SYMBOL_GPL (retu_read_adc);static irqreturn_t retu_irq_handler (int irq,void *_retu) {
Signature · 1 line
1.7.4.rc2
PATCH 5/6 cbus: retu: tabify retu initialization
In reply to Felipe Balbiand while at that, save a register and drop
the irq variable which is used right before
initializing it to retu->irq.
--- drivers/cbus/retu.c | 25 +++++++++++-------------- 1 files changed, 11 insertions(+), 14 deletions(-)
drivers/cbus/retu.c +11 -14
@@ -438,7 +438,6 @@ static int __init retu_probe(struct platform_device *pdev)int ret = -ENOMEM ;int rev; -int irq; retu =kzalloc (sizeof (*retu),GFP_KERNEL );if (!retu) {
@@ -447,16 +446,14 @@ static int __init retu_probe(struct platform_device *pdev) }platform_set_drvdata (pdev, retu); - the_retu = retu; -mutex_init (&retu->mutex); - - irq =platform_get_irq (pdev,0 ); + retu->irq =platform_get_irq (pdev,0 ); + retu->irq_base = pdata->irq_base; + retu->irq_end = pdata->irq_end; + retu->devid = pdata->devid; + the_retu = retu; - retu->irq = irq; - retu->irq_base = pdata->irq_base; - retu->irq_end = pdata->irq_end; - retu->devid = pdata->devid; +mutex_init (&retu->mutex);retu_irq_init (retu);
@@ -471,14 +468,14 @@ static int __init retu_probe(struct platform_device *pdev)/* Mask all RETU interrupts */ __retu_write_reg (retu,RETU_REG_IMR ,0xffff ); - ret =request_threaded_irq (irq,NULL , retu_irq_handler,0 , + ret =request_threaded_irq (retu->irq,NULL , retu_irq_handler,0 ,"retu" , retu);if (ret <0 ) {dev_err (&pdev->dev,"Unable to register IRQ handler\n" ); goto err1; } -set_irq_wake (irq,1 ); +set_irq_wake (retu->irq,1 );/* Register power off function */ pm_power_off = retu_power_off;
@@ -493,7 +490,7 @@ static int __init retu_probe(struct platform_device *pdev) err2:__retu_write_reg (retu,RETU_REG_IMR ,0xffff ); -free_irq (irq, retu); +free_irq (retu->irq, retu); err1:kfree (retu);
@@ -506,13 +503,13 @@ err0: static int __exit retu_remove(struct platform_device *pdev) {struct retu *retu =platform_get_drvdata (pdev); -int irq; irq =platform_get_irq (pdev,0 );/* Mask all RETU interrupts */ __retu_write_reg (retu,RETU_REG_IMR ,0xffff ); -free_irq (irq, retu); + +free_irq (retu->irq, retu);retu_irq_exit (retu);kfree (retu); the_retu =NULL ;
Signature · 1 line
1.7.4.rc2
PATCH 6/6 cbus: retu: set pm_power_off to NULL when removing retu
In reply to Felipe Balbiwe need to clear pm_power_off otherwise we
will have kernel trying to call an unexistent
function.
--- drivers/cbus/retu.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/cbus/retu.c +3 -2
@@ -489,6 +489,7 @@ static int __init retu_probe(struct platform_device *pdev)return 0 ; err2: + pm_power_off =NULL ;__retu_write_reg (retu,RETU_REG_IMR ,0xffff );free_irq (retu->irq, retu);
@@ -504,7 +505,8 @@ static int __exit retu_remove(struct platform_device *pdev) {struct retu *retu =platform_get_drvdata (pdev); - irq =platform_get_irq (pdev,0 ); + pm_power_off =NULL ; + the_retu =NULL ;/* Mask all RETU interrupts */ __retu_write_reg (retu,RETU_REG_IMR ,0xffff );
@@ -512,7 +514,6 @@ static int __exit retu_remove(struct platform_device *pdev)free_irq (retu->irq, retu);retu_irq_exit (retu);kfree (retu); - the_retu =NULL ;return 0 ; }
Signature · 1 line
1.7.4.rc2
Re: [PATCH 5/6] cbus: retu: tabify retu initialization
In reply to Felipe BalbiHi,
drivers/cbus/retu.c err0: · line 507
Quoted 7 lines · Felipe Balbi
drivers/cbus/retu.c +0
-1@@ -506,13 +503,13 @@ err0: static int __exit retu_remove(struct platform_device *pdev) {struct retu *retu =platform_get_drvdata (pdev); -int irq; irq =platform_get_irq (pdev,0 );
this should have been deleted. I compiled this.. oh well, I'm sending another version of this.
Signature · 1 line
balbi
Re: [PATCH 6/6] cbus: retu: set pm_power_off to NULL when removing retu
In reply to Felipe BalbiQuoted 22 lines · Felipe Balbi
we need to clear
pm_power_offotherwise we
will have kernel trying to call an unexistent
function.Signed-off-by Felipe Balbi <[email protected]>--- drivers/cbus/retu.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)drivers/cbus/retu.c +1
-0@@ -489,6 +489,7 @@ static int __init retu_probe(struct platform_device *pdev)return 0 ; err2: + pm_power_off =NULL ;__retu_write_reg (retu,RETU_REG_IMR ,0xffff );free_irq (retu->irq, retu);
drivers/cbus/retu.c static int __exit retu_remove(struct platform_device *pdev) · line 509
Quoted 6 lines
drivers/cbus/retu.c +2
-1@@ -504,7 +505,8 @@ static int __exit retu_remove(struct platform_device *pdev) {struct retu *retu =platform_get_drvdata (pdev); - irq =platform_get_irq (pdev,0 ); + pm_power_off =NULL ; + the_retu =NULL ;
there it goes, I commited that hunk to the wrong patch. Sorry about that.
Signature · 1 line
balbi