aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/radio/si470x
diff options
context:
space:
mode:
authorJoonyoung Shim <jy0922.shim@samsung.com>2011-03-11 01:54:48 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-05-20 08:27:47 -0400
commit474fdc0822abd36d38041c0f02513adb5006f6cb (patch)
tree8ab1f601aac931296b6abb9febacd53941a1583e /drivers/media/radio/si470x
parent949cf31cb00c16a1011c73c43f30cd3e2dfb6610 (diff)
[media] radio-si470x: convert to use request_threaded_irq()
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/radio/si470x')
-rw-r--r--drivers/media/radio/si470x/radio-si470x-i2c.c32
-rw-r--r--drivers/media/radio/si470x/radio-si470x.h1
2 files changed, 9 insertions, 24 deletions
diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c
index 898f68a83611..a2a67772c42c 100644
--- a/drivers/media/radio/si470x/radio-si470x-i2c.c
+++ b/drivers/media/radio/si470x/radio-si470x-i2c.c
@@ -262,12 +262,11 @@ int si470x_vidioc_querycap(struct file *file, void *priv,
262 **************************************************************************/ 262 **************************************************************************/
263 263
264/* 264/*
265 * si470x_i2c_interrupt_work - rds processing function 265 * si470x_i2c_interrupt - interrupt handler
266 */ 266 */
267static void si470x_i2c_interrupt_work(struct work_struct *work) 267static irqreturn_t si470x_i2c_interrupt(int irq, void *dev_id)
268{ 268{
269 struct si470x_device *radio = container_of(work, 269 struct si470x_device *radio = dev_id;
270 struct si470x_device, radio_work);
271 unsigned char regnr; 270 unsigned char regnr;
272 unsigned char blocknum; 271 unsigned char blocknum;
273 unsigned short bler; /* rds block errors */ 272 unsigned short bler; /* rds block errors */
@@ -278,26 +277,26 @@ static void si470x_i2c_interrupt_work(struct work_struct *work)
278 /* check Seek/Tune Complete */ 277 /* check Seek/Tune Complete */
279 retval = si470x_get_register(radio, STATUSRSSI); 278 retval = si470x_get_register(radio, STATUSRSSI);
280 if (retval < 0) 279 if (retval < 0)
281 return; 280 goto end;
282 281
283 if (radio->registers[STATUSRSSI] & STATUSRSSI_STC) 282 if (radio->registers[STATUSRSSI] & STATUSRSSI_STC)
284 complete(&radio->completion); 283 complete(&radio->completion);
285 284
286 /* safety checks */ 285 /* safety checks */
287 if ((radio->registers[SYSCONFIG1] & SYSCONFIG1_RDS) == 0) 286 if ((radio->registers[SYSCONFIG1] & SYSCONFIG1_RDS) == 0)
288 return; 287 goto end;
289 288
290 /* Update RDS registers */ 289 /* Update RDS registers */
291 for (regnr = 1; regnr < RDS_REGISTER_NUM; regnr++) { 290 for (regnr = 1; regnr < RDS_REGISTER_NUM; regnr++) {
292 retval = si470x_get_register(radio, STATUSRSSI + regnr); 291 retval = si470x_get_register(radio, STATUSRSSI + regnr);
293 if (retval < 0) 292 if (retval < 0)
294 return; 293 goto end;
295 } 294 }
296 295
297 /* get rds blocks */ 296 /* get rds blocks */
298 if ((radio->registers[STATUSRSSI] & STATUSRSSI_RDSR) == 0) 297 if ((radio->registers[STATUSRSSI] & STATUSRSSI_RDSR) == 0)
299 /* No RDS group ready, better luck next time */ 298 /* No RDS group ready, better luck next time */
300 return; 299 goto end;
301 300
302 for (blocknum = 0; blocknum < 4; blocknum++) { 301 for (blocknum = 0; blocknum < 4; blocknum++) {
303 switch (blocknum) { 302 switch (blocknum) {
@@ -351,19 +350,8 @@ static void si470x_i2c_interrupt_work(struct work_struct *work)
351 350
352 if (radio->wr_index != radio->rd_index) 351 if (radio->wr_index != radio->rd_index)
353 wake_up_interruptible(&radio->read_queue); 352 wake_up_interruptible(&radio->read_queue);
354}
355
356
357/*
358 * si470x_i2c_interrupt - interrupt handler
359 */
360static irqreturn_t si470x_i2c_interrupt(int irq, void *dev_id)
361{
362 struct si470x_device *radio = dev_id;
363
364 if (!work_pending(&radio->radio_work))
365 schedule_work(&radio->radio_work);
366 353
354end:
367 return IRQ_HANDLED; 355 return IRQ_HANDLED;
368} 356}
369 357
@@ -385,7 +373,6 @@ static int __devinit si470x_i2c_probe(struct i2c_client *client,
385 goto err_initial; 373 goto err_initial;
386 } 374 }
387 375
388 INIT_WORK(&radio->radio_work, si470x_i2c_interrupt_work);
389 radio->users = 0; 376 radio->users = 0;
390 radio->client = client; 377 radio->client = client;
391 mutex_init(&radio->lock); 378 mutex_init(&radio->lock);
@@ -454,7 +441,7 @@ static int __devinit si470x_i2c_probe(struct i2c_client *client,
454 radio->stci_enabled = true; 441 radio->stci_enabled = true;
455 init_completion(&radio->completion); 442 init_completion(&radio->completion);
456 443
457 retval = request_irq(client->irq, si470x_i2c_interrupt, 444 retval = request_threaded_irq(client->irq, NULL, si470x_i2c_interrupt,
458 IRQF_TRIGGER_FALLING, DRIVER_NAME, radio); 445 IRQF_TRIGGER_FALLING, DRIVER_NAME, radio);
459 if (retval) { 446 if (retval) {
460 dev_err(&client->dev, "Failed to register interrupt\n"); 447 dev_err(&client->dev, "Failed to register interrupt\n");
@@ -492,7 +479,6 @@ static __devexit int si470x_i2c_remove(struct i2c_client *client)
492 struct si470x_device *radio = i2c_get_clientdata(client); 479 struct si470x_device *radio = i2c_get_clientdata(client);
493 480
494 free_irq(client->irq, radio); 481 free_irq(client->irq, radio);
495 cancel_work_sync(&radio->radio_work);
496 video_unregister_device(radio->videodev); 482 video_unregister_device(radio->videodev);
497 kfree(radio); 483 kfree(radio);
498 484
diff --git a/drivers/media/radio/si470x/radio-si470x.h b/drivers/media/radio/si470x/radio-si470x.h
index 9ef671657771..68da001b09dc 100644
--- a/drivers/media/radio/si470x/radio-si470x.h
+++ b/drivers/media/radio/si470x/radio-si470x.h
@@ -182,7 +182,6 @@ struct si470x_device {
182 182
183#if defined(CONFIG_I2C_SI470X) || defined(CONFIG_I2C_SI470X_MODULE) 183#if defined(CONFIG_I2C_SI470X) || defined(CONFIG_I2C_SI470X_MODULE)
184 struct i2c_client *client; 184 struct i2c_client *client;
185 struct work_struct radio_work;
186#endif 185#endif
187}; 186};
188 187