MIPS: Remove no-op/identity casts
authorPaul Burton <paul.burton@mips.com>
Fri, 31 Aug 2018 18:49:20 +0000 (11:49 -0700)
committerPaul Burton <paul.burton@mips.com>
Fri, 31 Aug 2018 18:49:20 +0000 (11:49 -0700)
Clean up instances of casts to the type that a value already has, since
they are effectively no-ops and only serve to complicate the code.

This is the result of the following semantic patch:

  @identitycast@
  type T;
  T *A;
  @@
  - (T *)(A)
  + A

Signed-off-by: Paul Burton <paul.burton@mips.com>
Patchwork: https://patchwork.linux-mips.org/patch/19599/

arch/mips/kernel/relocate.c
arch/mips/kernel/traps.c
arch/mips/loongson64/loongson-3/smp.c
arch/mips/pmcs-msp71xx/msp_usb.c
arch/mips/sgi-ip22/ip28-berr.c

index cbf4cc0..3d80a51 100644 (file)
@@ -146,7 +146,7 @@ int __init do_relocations(void *kbase_old, void *kbase_new, long offset)
                        break;
 
                type = (*r >> 24) & 0xff;
-               loc_orig = (void *)(kbase_old + ((*r & 0x00ffffff) << 2));
+               loc_orig = kbase_old + ((*r & 0x00ffffff) << 2);
                loc_new = RELOCATED(loc_orig);
 
                if (reloc_handlers_rel[type] == NULL) {
index 9dab0ed..576aeef 100644 (file)
@@ -348,7 +348,7 @@ static void __show_regs(const struct pt_regs *regs)
  */
 void show_regs(struct pt_regs *regs)
 {
-       __show_regs((struct pt_regs *)regs);
+       __show_regs(regs);
        dump_stack();
 }
 
index fea95d0..361239b 100644 (file)
@@ -349,7 +349,7 @@ static void loongson3_smp_finish(void)
        write_c0_compare(read_c0_count() + mips_hpt_frequency/HZ);
        local_irq_enable();
        loongson3_ipi_write64(0,
-                       (void *)(ipi_mailbox_buf[cpu_logical_map(cpu)]+0x0));
+                       ipi_mailbox_buf[cpu_logical_map(cpu)] + 0x0);
        pr_info("CPU#%d finished, CP0_ST=%x\n",
                        smp_processor_id(), read_c0_status());
 }
@@ -416,13 +416,13 @@ static int loongson3_boot_secondary(int cpu, struct task_struct *idle)
                        cpu, startargs[0], startargs[1], startargs[2]);
 
        loongson3_ipi_write64(startargs[3],
-                       (void *)(ipi_mailbox_buf[cpu_logical_map(cpu)]+0x18));
+                       ipi_mailbox_buf[cpu_logical_map(cpu)] + 0x18);
        loongson3_ipi_write64(startargs[2],
-                       (void *)(ipi_mailbox_buf[cpu_logical_map(cpu)]+0x10));
+                       ipi_mailbox_buf[cpu_logical_map(cpu)] + 0x10);
        loongson3_ipi_write64(startargs[1],
-                       (void *)(ipi_mailbox_buf[cpu_logical_map(cpu)]+0x8));
+                       ipi_mailbox_buf[cpu_logical_map(cpu)] + 0x8);
        loongson3_ipi_write64(startargs[0],
-                       (void *)(ipi_mailbox_buf[cpu_logical_map(cpu)]+0x0));
+                       ipi_mailbox_buf[cpu_logical_map(cpu)] + 0x0);
        return 0;
 }
 
index c87c5f8..d38ac70 100644 (file)
@@ -133,13 +133,13 @@ static int __init msp_usb_setup(void)
         * "D" for device-mode.  If it works for Ethernet, why not USB...
         *  -- hammtrev, 2007/03/22
         */
-       snprintf((char *)&envstr[0], sizeof(envstr), "usbmode");
+       snprintf(&envstr[0], sizeof(envstr), "usbmode");
 
        /* set default host mode */
        val = 1;
 
        /* get environment string */
-       strp = prom_getenv((char *)&envstr[0]);
+       strp = prom_getenv(&envstr[0]);
        if (strp) {
                /* compare string */
                if (!strcmp(strp, "device"))
index 2ed8e49..082541d 100644 (file)
@@ -464,7 +464,7 @@ void ip22_be_interrupt(int irq)
                die_if_kernel("Oops", regs);
                force_sig(SIGBUS, current);
        } else if (debug_be_interrupt)
-               show_regs((struct pt_regs *)regs);
+               show_regs(regs);
 }
 
 static int ip28_be_handler(struct pt_regs *regs, int is_fixup)