Commit 21a18db4e5f83bb3eab06fa765dd945f492dbe05
1 parent
e0ee7939ee
Exists in
master
input: TSC: fix errors related to using driver as module
This patch removes errors related to module usage of TSC Signed-off-by: Patil, Rachna <rachna@ti.com>
Showing 1 changed file with 30 additions and 16 deletions Side-by-side Diff
drivers/input/touchscreen/ti_tscadc.c
... | ... | @@ -104,7 +104,7 @@ |
104 | 104 | int wires; |
105 | 105 | int analog_input; |
106 | 106 | int x_plate_resistance; |
107 | - struct clk *clk; | |
107 | + struct clk *tsc_ick; | |
108 | 108 | int irq; |
109 | 109 | void __iomem *tsc_base; |
110 | 110 | }; |
... | ... | @@ -379,7 +379,7 @@ |
379 | 379 | int clock_rate, irqenable, ctrl; |
380 | 380 | struct tsc_data *pdata = pdev->dev.platform_data; |
381 | 381 | struct resource *res; |
382 | - struct clk *tsc_ick; | |
382 | + struct clk *clk; | |
383 | 383 | |
384 | 384 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
385 | 385 | if (!res) { |
... | ... | @@ -408,6 +408,13 @@ |
408 | 408 | } |
409 | 409 | ts_dev->input = input_dev; |
410 | 410 | |
411 | + res = request_mem_region(res->start, resource_size(res), pdev->name); | |
412 | + if (!res) { | |
413 | + dev_err(&pdev->dev, "failed to reserve registers.\n"); | |
414 | + err = -EBUSY; | |
415 | + goto err_free_mem; | |
416 | + } | |
417 | + | |
411 | 418 | ts_dev->tsc_base = ioremap(res->start, resource_size(res)); |
412 | 419 | if (!ts_dev->tsc_base) { |
413 | 420 | dev_err(&pdev->dev, "failed to map registers.\n"); |
414 | 421 | |
415 | 422 | |
416 | 423 | |
417 | 424 | |
... | ... | @@ -422,20 +429,20 @@ |
422 | 429 | goto err_unmap_regs; |
423 | 430 | } |
424 | 431 | |
425 | - tsc_ick = clk_get(&pdev->dev, "adc_tsc_ick"); | |
426 | - if (IS_ERR(tsc_ick)) { | |
432 | + ts_dev->tsc_ick = clk_get(&pdev->dev, "adc_tsc_ick"); | |
433 | + if (IS_ERR(ts_dev->tsc_ick)) { | |
427 | 434 | dev_err(&pdev->dev, "failed to get TSC ick\n"); |
428 | 435 | goto err_free_irq; |
429 | 436 | } |
430 | - clk_enable(tsc_ick); | |
437 | + clk_enable(ts_dev->tsc_ick); | |
431 | 438 | |
432 | - ts_dev->clk = clk_get(&pdev->dev, "adc_tsc_fck"); | |
433 | - if (IS_ERR(ts_dev->clk)) { | |
439 | + clk = clk_get(&pdev->dev, "adc_tsc_fck"); | |
440 | + if (IS_ERR(clk)) { | |
434 | 441 | dev_err(&pdev->dev, "failed to get TSC fck\n"); |
435 | - err = PTR_ERR(ts_dev->clk); | |
442 | + err = PTR_ERR(clk); | |
436 | 443 | goto err_free_irq; |
437 | 444 | } |
438 | - clock_rate = clk_get_rate(ts_dev->clk); | |
445 | + clock_rate = clk_get_rate(clk); | |
439 | 446 | clk_value = clock_rate / ADC_CLK; |
440 | 447 | if (clk_value < 7) { |
441 | 448 | dev_err(&pdev->dev, "clock input less than min clock requirement\n"); |
442 | 449 | |
... | ... | @@ -498,11 +505,12 @@ |
498 | 505 | if (err) |
499 | 506 | goto err_fail; |
500 | 507 | |
508 | + platform_set_drvdata(pdev, ts_dev); | |
501 | 509 | return 0; |
502 | 510 | |
503 | 511 | err_fail: |
504 | - clk_disable(ts_dev->clk); | |
505 | - clk_put(ts_dev->clk); | |
512 | + clk_disable(ts_dev->tsc_ick); | |
513 | + clk_put(ts_dev->tsc_ick); | |
506 | 514 | err_free_irq: |
507 | 515 | free_irq(ts_dev->irq, ts_dev); |
508 | 516 | err_unmap_regs: |
... | ... | @@ -517,7 +525,7 @@ |
517 | 525 | |
518 | 526 | static int __devexit tscadc_remove(struct platform_device *pdev) |
519 | 527 | { |
520 | - struct tscadc *ts_dev = dev_get_drvdata(&pdev->dev); | |
528 | + struct tscadc *ts_dev = platform_get_drvdata(pdev); | |
521 | 529 | struct resource *res; |
522 | 530 | |
523 | 531 | free_irq(ts_dev->irq, ts_dev); |
524 | 532 | |
... | ... | @@ -528,11 +536,12 @@ |
528 | 536 | iounmap(ts_dev->tsc_base); |
529 | 537 | release_mem_region(res->start, resource_size(res)); |
530 | 538 | |
531 | - clk_disable(ts_dev->clk); | |
532 | - clk_put(ts_dev->clk); | |
539 | + clk_disable(ts_dev->tsc_ick); | |
540 | + clk_put(ts_dev->tsc_ick); | |
533 | 541 | |
534 | 542 | kfree(ts_dev); |
535 | 543 | |
544 | + platform_set_drvdata(pdev, NULL); | |
536 | 545 | return 0; |
537 | 546 | } |
538 | 547 | |
... | ... | @@ -541,6 +550,7 @@ |
541 | 550 | .remove = __devexit_p(tscadc_remove), |
542 | 551 | .driver = { |
543 | 552 | .name = "tsc", |
553 | + .owner = THIS_MODULE, | |
544 | 554 | }, |
545 | 555 | }; |
546 | 556 | |
547 | 557 | |
548 | 558 | |
... | ... | @@ -548,12 +558,15 @@ |
548 | 558 | { |
549 | 559 | return platform_driver_register(&ti_tsc_driver); |
550 | 560 | } |
561 | +module_init(ti_tsc_init); | |
551 | 562 | |
552 | 563 | static void __exit ti_tsc_exit(void) |
553 | 564 | { |
554 | 565 | platform_driver_unregister(&ti_tsc_driver); |
555 | 566 | } |
556 | - | |
557 | -module_init(ti_tsc_init); | |
558 | 567 | module_exit(ti_tsc_exit); |
568 | + | |
569 | +MODULE_DESCRIPTION("TI touchscreen controller driver"); | |
570 | +MODULE_AUTHOR("Rachna Patil <rachna@ti.com>"); | |
571 | +MODULE_LICENSE("GPL"); |