aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2008-10-31 12:10:30 -0400
committerBen Dooks <ben-linux@fluff.org>2008-12-16 15:27:28 -0500
commite0d1ec97853fa09cf676dc6b51dafd35db12759e (patch)
tree4661e3f0ed2d62ae54026213f0f36f413558f1b7 /drivers/i2c
parent692acbd3a866a9f84e18a5980b3a97ca52e501b2 (diff)
i2c-s3c2410: Change IRQ to be plain integer.
Change the code to use a plain integer as the holder for the IRQ for the device and use platform_get_irq() to find it. This makes the code slightly neater, and easier to get the IRQ number. Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-s3c2410.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index f14007ff2531..2a0de645ccf3 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -61,6 +61,7 @@ struct s3c24xx_i2c {
61 unsigned int msg_ptr; 61 unsigned int msg_ptr;
62 62
63 unsigned int tx_setup; 63 unsigned int tx_setup;
64 unsigned int irq;
64 65
65 enum s3c24xx_i2c_state state; 66 enum s3c24xx_i2c_state state;
66 unsigned long clkrate; 67 unsigned long clkrate;
@@ -68,7 +69,6 @@ struct s3c24xx_i2c {
68 void __iomem *regs; 69 void __iomem *regs;
69 struct clk *clk; 70 struct clk *clk;
70 struct device *dev; 71 struct device *dev;
71 struct resource *irq;
72 struct resource *ioarea; 72 struct resource *ioarea;
73 struct i2c_adapter adap; 73 struct i2c_adapter adap;
74 74
@@ -869,26 +869,20 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
869 * ensure no current IRQs pending 869 * ensure no current IRQs pending
870 */ 870 */
871 871
872 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 872 i2c->irq = ret = platform_get_irq(pdev, 0);
873 if (res == NULL) { 873 if (ret <= 0) {
874 dev_err(&pdev->dev, "cannot find IRQ\n"); 874 dev_err(&pdev->dev, "cannot find IRQ\n");
875 ret = -ENOENT;
876 goto err_iomap; 875 goto err_iomap;
877 } 876 }
878 877
879 ret = request_irq(res->start, s3c24xx_i2c_irq, IRQF_DISABLED, 878 ret = request_irq(i2c->irq, s3c24xx_i2c_irq, IRQF_DISABLED,
880 pdev->name, i2c); 879 dev_name(&pdev->dev), i2c);
881 880
882 if (ret != 0) { 881 if (ret != 0) {
883 dev_err(&pdev->dev, "cannot claim IRQ\n"); 882 dev_err(&pdev->dev, "cannot claim IRQ %d\n", i2c->irq);
884 goto err_iomap; 883 goto err_iomap;
885 } 884 }
886 885
887 i2c->irq = res;
888
889 dev_dbg(&pdev->dev, "irq resource %p (%lu)\n", res,
890 (unsigned long)res->start);
891
892 ret = s3c24xx_i2c_register_cpufreq(i2c); 886 ret = s3c24xx_i2c_register_cpufreq(i2c);
893 if (ret < 0) { 887 if (ret < 0) {
894 dev_err(&pdev->dev, "failed to register cpufreq notifier\n"); 888 dev_err(&pdev->dev, "failed to register cpufreq notifier\n");
@@ -918,7 +912,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
918 s3c24xx_i2c_deregister_cpufreq(i2c); 912 s3c24xx_i2c_deregister_cpufreq(i2c);
919 913
920 err_irq: 914 err_irq:
921 free_irq(i2c->irq->start, i2c); 915 free_irq(i2c->irq, i2c);
922 916
923 err_iomap: 917 err_iomap:
924 iounmap(i2c->regs); 918 iounmap(i2c->regs);
@@ -948,7 +942,7 @@ static int s3c24xx_i2c_remove(struct platform_device *pdev)
948 s3c24xx_i2c_deregister_cpufreq(i2c); 942 s3c24xx_i2c_deregister_cpufreq(i2c);
949 943
950 i2c_del_adapter(&i2c->adap); 944 i2c_del_adapter(&i2c->adap);
951 free_irq(i2c->irq->start, i2c); 945 free_irq(i2c->irq, i2c);
952 946
953 clk_disable(i2c->clk); 947 clk_disable(i2c->clk);
954 clk_put(i2c->clk); 948 clk_put(i2c->clk);