Merge branch 'sh-latest' of git://github.com/pmundt/linux-sh
[pandora-kernel.git] / arch / arm / mach-omap2 / omap_l3_smx.c
index 873c0e3..a05a62f 100644 (file)
@@ -1,26 +1,26 @@
- /*
 * OMAP3XXX L3 Interconnect Driver
 *
 * Copyright (C) 2011 Texas Corporation
 *    Felipe Balbi <balbi@ti.com>
 *    Santosh Shilimkar <santosh.shilimkar@ti.com>
 *    Sricharan <r.sricharan@ti.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 * USA
 */
+/*
+ * OMAP3XXX L3 Interconnect Driver
+ *
+ * Copyright (C) 2011 Texas Corporation
    Felipe Balbi <balbi@ti.com>
    Santosh Shilimkar <santosh.shilimkar@ti.com>
    Sricharan <r.sricharan@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
 
 #include <linux/kernel.h>
 #include <linux/slab.h>
@@ -135,7 +135,7 @@ static char *omap3_l3_initiator_string(u8 initid)
        }
 }
 
-/**
+/*
  * omap3_l3_block_irq - handles a register block's irq
  * @l3: struct omap3_l3 *
  * @base: register block base address
@@ -150,30 +150,29 @@ static char *omap3_l3_initiator_string(u8 initid)
 static irqreturn_t omap3_l3_block_irq(struct omap3_l3 *l3,
                                        u64 error, int error_addr)
 {
-       u8                      code = omap3_l3_decode_error_code(error);
-       u8                      initid = omap3_l3_decode_initid(error);
-       u8                      multi = error & L3_ERROR_LOG_MULTI;
-       u32                     address = omap3_l3_decode_addr(error_addr);
+       u8 code = omap3_l3_decode_error_code(error);
+       u8 initid = omap3_l3_decode_initid(error);
+       u8 multi = error & L3_ERROR_LOG_MULTI;
+       u32 address = omap3_l3_decode_addr(error_addr);
 
        WARN(true, "%s seen by %s %s at address %x\n",
-                                omap3_l3_code_string(code),
-                         omap3_l3_initiator_string(initid),
-                            multi ? "Multiple Errors" : "",
-                                                  address);
+                       omap3_l3_code_string(code),
+                       omap3_l3_initiator_string(initid),
+                       multi ? "Multiple Errors" : "", address);
 
        return IRQ_HANDLED;
 }
 
 static irqreturn_t omap3_l3_app_irq(int irq, void *_l3)
 {
-       struct omap3_l3         *l3 = _l3;
-       u64                     status, clear;
-       u64                     error;
-       u64                     error_addr;
-       u64                     err_source = 0;
-       void                    __iomem *base;
-       int                     int_type;
-       irqreturn_t             ret = IRQ_NONE;
+       struct omap3_l3 *l3 = _l3;
+       u64 status, clear;
+       u64 error;
+       u64 error_addr;
+       u64 err_source = 0;
+       void __iomem *base;
+       int int_type;
+       irqreturn_t ret = IRQ_NONE;
 
        int_type = irq == l3->app_irq ? L3_APPLICATION_ERROR : L3_DEBUG_ERROR;
        if (!int_type) {
@@ -191,14 +190,12 @@ static irqreturn_t omap3_l3_app_irq(int irq, void *_l3)
        }
 
        /* identify the error source */
-       for (err_source = 0; !(status & (1 << err_source)); err_source++)
-                                                                       ;
+       err_source = __ffs(status);
 
-       base = l3->rt + *(omap3_l3_bases[int_type] + err_source);
+       base = l3->rt + omap3_l3_bases[int_type][err_source];
        error = omap3_l3_readll(base, L3_ERROR_LOG);
        if (error) {
                error_addr = omap3_l3_readll(base, L3_ERROR_LOG_ADDR);
-
                ret |= omap3_l3_block_irq(l3, error, error_addr);
        }
 
@@ -215,9 +212,9 @@ static irqreturn_t omap3_l3_app_irq(int irq, void *_l3)
 
 static int __init omap3_l3_probe(struct platform_device *pdev)
 {
-       struct omap3_l3         *l3;
-       struct resource         *res;
-       int                     ret;
+       struct omap3_l3 *l3;
+       struct resource *res;
+       int ret;
 
        l3 = kzalloc(sizeof(*l3), GFP_KERNEL);
        if (!l3)