source: branches/contrib/debian/package-build/linux-patch-bcm47xx/patches-3.16/031-06-MIPS-BCM47XX-Fix-coding-style-to-match-kernel-standa.patch @ 671

Last change on this file since 671 was 671, checked in by ehem, 5 years ago

Initial experimental set of patches against Debian's 3.16 kernel for
Broadcom 47xx devices. These are mostly untested and are likely to fail
spectacularly. Progress appears to be being made towards building a
kernel that may work on actual hardware.

File size: 9.4 KB
  • arch/mips/bcm47xx/bcm47xx_private.h

    From d548ca6b0784a99f0fcae397f115823ccd0361a5 Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
    Date: Wed, 10 Dec 2014 17:38:26 +0100
    Subject: [PATCH] MIPS: BCM47XX: Fix coding style to match kernel standards
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    
    [ralf@linux-mips.org: Fixed conflicts.]
    
    Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
    Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
    Cc: linux-mips@linux-mips.org
    Cc: Paul Walmsley <paul@pwsan.com>
    Patchwork: https://patchwork.linux-mips.org/patch/8665/
    Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
    ---
     arch/mips/bcm47xx/bcm47xx_private.h |  4 ++++
     arch/mips/bcm47xx/board.c           |  3 +--
     arch/mips/bcm47xx/nvram.c           | 25 ++++++++++++++-----------
     arch/mips/bcm47xx/prom.c            |  3 +--
     arch/mips/bcm47xx/serial.c          |  8 ++++----
     arch/mips/bcm47xx/setup.c           | 12 ++++++------
     arch/mips/bcm47xx/sprom.c           |  8 ++++----
     arch/mips/bcm47xx/time.c            |  1 -
     8 files changed, 34 insertions(+), 30 deletions(-)
    
    diff --git a/arch/mips/bcm47xx/bcm47xx_private.h b/arch/mips/bcm47xx/bcm47xx_private.h
    index ea909a5..41796be 100644
    a b  
    11#ifndef LINUX_BCM47XX_PRIVATE_H_
    22#define LINUX_BCM47XX_PRIVATE_H_
    33
     4#ifndef pr_fmt
     5#define pr_fmt(fmt)             "bcm47xx: " fmt
     6#endif
     7
    48#include <linux/kernel.h>
    59
    610/* prom.c */
  • arch/mips/bcm47xx/board.c

    diff --git a/arch/mips/bcm47xx/board.c b/arch/mips/bcm47xx/board.c
    index 6e85130..d4a5a51 100644
    a b void __init bcm47xx_board_detect(void) 
    330330        err = bcm47xx_nvram_getenv("boardtype", buf, sizeof(buf));
    331331
    332332        /* init of nvram failed, probably too early now */
    333         if (err == -ENXIO) {
     333        if (err == -ENXIO)
    334334                return;
    335         }
    336335
    337336        board_detected = bcm47xx_board_get_nvram();
    338337        bcm47xx_board.board = board_detected->board;
  • arch/mips/bcm47xx/nvram.c

    diff --git a/arch/mips/bcm47xx/nvram.c b/arch/mips/bcm47xx/nvram.c
    index 7c77a88..6a97732 100644
    a b  
    1818#include <linux/mtd/mtd.h>
    1919#include <linux/bcm47xx_nvram.h>
    2020
    21 #define NVRAM_MAGIC             0x48534C46      /* 'FLSH' */
    22 #define NVRAM_SPACE             0x8000
     21#define NVRAM_MAGIC                     0x48534C46      /* 'FLSH' */
     22#define NVRAM_SPACE                     0x8000
     23#define NVRAM_MAX_GPIO_ENTRIES          32
     24#define NVRAM_MAX_GPIO_VALUE_LEN        30
    2325
    2426#define FLASH_MIN               0x00020000      /* Minimum flash size */
    2527
    found: 
    9799                pr_err("nvram on flash (%i bytes) is bigger than the reserved space in memory, will just copy the first %i bytes\n",
    98100                       header->len, NVRAM_SPACE);
    99101
    100         src = (u32 *) header;
    101         dst = (u32 *) nvram_buf;
     102        src = (u32 *)header;
     103        dst = (u32 *)nvram_buf;
    102104        for (i = 0; i < sizeof(struct nvram_header); i += 4)
    103105                *dst++ = __raw_readl(src++);
    104106        for (; i < header->len && i < NVRAM_SPACE && i < size; i += 4)
    int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len) 
    189191        /* Look for name=value and return value */
    190192        var = &nvram_buf[sizeof(struct nvram_header)];
    191193        end = nvram_buf + sizeof(nvram_buf) - 2;
    192         end[0] = end[1] = '\0';
     194        end[0] = '\0';
     195        end[1] = '\0';
    193196        for (; *var; var = value + strlen(value) + 1) {
    194197                data_left = end - var;
    195198
    int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len) 
    197200                if (!eq)
    198201                        break;
    199202                value = eq + 1;
    200                 if ((eq - var) == strlen(name) &&
    201                         strncmp(var, name, (eq - var)) == 0) {
     203                if (eq - var == strlen(name) &&
     204                    strncmp(var, name, eq - var) == 0)
    202205                        return snprintf(val, val_len, "%s", value);
    203206                }
    204         }
    205207        return -ENOENT;
    206208}
    207209EXPORT_SYMBOL(bcm47xx_nvram_getenv);
    EXPORT_SYMBOL(bcm47xx_nvram_getenv); 
    209211int bcm47xx_nvram_gpio_pin(const char *name)
    210212{
    211213        int i, err;
    212         char nvram_var[10];
    213         char buf[30];
     214        char nvram_var[] = "gpioXX";
     215        char buf[NVRAM_MAX_GPIO_VALUE_LEN];
    214216
    215         for (i = 0; i < 32; i++) {
     217        /* TODO: Optimize it to don't call getenv so many times */
     218        for (i = 0; i < NVRAM_MAX_GPIO_ENTRIES; i++) {
    216219                err = snprintf(nvram_var, sizeof(nvram_var), "gpio%i", i);
    217220                if (err <= 0)
    218221                        continue;
  • arch/mips/bcm47xx/prom.c

    diff --git a/arch/mips/bcm47xx/prom.c b/arch/mips/bcm47xx/prom.c
    index 1b170bf..ab698ba 100644
    a b  
    3535#include <bcm47xx.h>
    3636#include <bcm47xx_board.h>
    3737
    38 
    3938static char bcm47xx_system_type[20] = "Broadcom BCM47XX";
    4039
    4140const char *get_system_type(void)
    static __init void prom_init_mem(void) 
    8382                /* Loop condition may be not enough, off may be over 1 MiB */
    8483                if (off + mem >= max) {
    8584                        mem = max;
    86                         printk(KERN_DEBUG "assume 128MB RAM\n");
     85                        pr_debug("Assume 128MB RAM\n");
    8786                        break;
    8887                }
    8988                if (!memcmp(prom_init, prom_init + mem, 32))
  • arch/mips/bcm47xx/serial.c

    diff --git a/arch/mips/bcm47xx/serial.c b/arch/mips/bcm47xx/serial.c
    index 2f5bbd6..df761d3 100644
    a b static int __init uart8250_init_ssb(void) 
    3636                struct plat_serial8250_port *p = &(uart8250_data[i]);
    3737                struct ssb_serial_port *ssb_port = &(mcore->serial_ports[i]);
    3838
    39                 p->mapbase = (unsigned int) ssb_port->regs;
    40                 p->membase = (void *) ssb_port->regs;
     39                p->mapbase = (unsigned int)ssb_port->regs;
     40                p->membase = (void *)ssb_port->regs;
    4141                p->irq = ssb_port->irq + 2;
    4242                p->uartclk = ssb_port->baud_base;
    4343                p->regshift = ssb_port->reg_shift;
    static int __init uart8250_init_bcma(void) 
    6262                struct bcma_serial_port *bcma_port;
    6363                bcma_port = &(cc->serial_ports[i]);
    6464
    65                 p->mapbase = (unsigned int) bcma_port->regs;
    66                 p->membase = (void *) bcma_port->regs;
     65                p->mapbase = (unsigned int)bcma_port->regs;
     66                p->membase = (void *)bcma_port->regs;
    6767                p->irq = bcma_port->irq;
    6868                p->uartclk = bcma_port->baud_base;
    6969                p->regshift = bcma_port->reg_shift;
  • arch/mips/bcm47xx/setup.c

    diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
    index b26c9c2..82ff9fd 100644
    a b EXPORT_SYMBOL(bcm47xx_bus_type); 
    5252
    5353static void bcm47xx_machine_restart(char *command)
    5454{
    55         printk(KERN_ALERT "Please stand by while rebooting the system...\n");
     55        pr_alert("Please stand by while rebooting the system...\n");
    5656        local_irq_disable();
    5757        /* Set the watchdog timer to reset immediately */
    5858        switch (bcm47xx_bus_type) {
    static int bcm47xx_get_invariants(struct ssb_bus *bus, 
    107107        char buf[20];
    108108
    109109        /* Fill boardinfo structure */
    110         memset(&(iv->boardinfo), 0 , sizeof(struct ssb_boardinfo));
     110        memset(&iv->boardinfo, 0 , sizeof(struct ssb_boardinfo));
    111111
    112112        bcm47xx_fill_ssb_boardinfo(&iv->boardinfo, NULL);
    113113
    static void __init bcm47xx_register_ssb(void) 
    126126        char buf[100];
    127127        struct ssb_mipscore *mcore;
    128128
    129         err = ssb_bus_ssbbus_register(&(bcm47xx_bus.ssb), SSB_ENUM_BASE,
     129        err = ssb_bus_ssbbus_register(&bcm47xx_bus.ssb, SSB_ENUM_BASE,
    130130                                      bcm47xx_get_invariants);
    131131        if (err)
    132132                panic("Failed to initialize SSB bus (err %d)", err);
    static void __init bcm47xx_register_ssb(void) 
    136136                if (strstr(buf, "console=ttyS1")) {
    137137                        struct ssb_serial_port port;
    138138
    139                         printk(KERN_DEBUG "Swapping serial ports!\n");
     139                        pr_debug("Swapping serial ports!\n");
    140140                        /* swap serial ports */
    141141                        memcpy(&port, &mcore->serial_ports[0], sizeof(port));
    142142                        memcpy(&mcore->serial_ports[0], &mcore->serial_ports[1],
    void __init plat_mem_setup(void) 
    168168        struct cpuinfo_mips *c = &current_cpu_data;
    169169
    170170        if ((c->cputype == CPU_74K) || (c->cputype == CPU_1074K)) {
    171                 printk(KERN_INFO "bcm47xx: using bcma bus\n");
     171                pr_info("Using bcma bus\n");
    172172#ifdef CONFIG_BCM47XX_BCMA
    173173                bcm47xx_bus_type = BCM47XX_BUS_TYPE_BCMA;
    174174                bcm47xx_sprom_register_fallbacks();
    void __init plat_mem_setup(void) 
    179179#endif
    180180#endif
    181181        } else {
    182                 printk(KERN_INFO "bcm47xx: using ssb bus\n");
     182                pr_info("Using ssb bus\n");
    183183#ifdef CONFIG_BCM47XX_SSB
    184184                bcm47xx_bus_type = BCM47XX_BUS_TYPE_SSB;
    185185                bcm47xx_sprom_register_fallbacks();
  • arch/mips/bcm47xx/sprom.c

    diff --git a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c
    index c114b02..5d32afc 100644
    a b void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix, 
    780780                bcm47xx_fill_sprom_path_r4589(sprom, prefix, fallback);
    781781                break;
    782782        default:
    783                 pr_warn("Unsupported SPROM revision %d detected. Will extract"
    784                         " v1\n", sprom->revision);
     783                pr_warn("Unsupported SPROM revision %d detected. Will extract v1\n",
     784                        sprom->revision);
    785785                sprom->revision = 1;
    786786                bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback);
    787787                bcm47xx_fill_sprom_r12389(sprom, prefix, fallback);
    static int bcm47xx_get_sprom_ssb(struct ssb_bus *bus, struct ssb_sprom *out) 
    828828                bcm47xx_fill_sprom(out, prefix, false);
    829829                return 0;
    830830        } else {
    831                 pr_warn("bcm47xx: unable to fill SPROM for given bustype.\n");
     831                pr_warn("Unable to fill SPROM for given bustype.\n");
    832832                return -EINVAL;
    833833        }
    834834}
    static int bcm47xx_get_sprom_bcma(struct bcma_bus *bus, struct ssb_sprom *out) 
    893893                }
    894894                return 0;
    895895        default:
    896                 pr_warn("bcm47xx: unable to fill SPROM for given bustype.\n");
     896                pr_warn("Unable to fill SPROM for given bustype.\n");
    897897                return -EINVAL;
    898898        }
    899899}
  • arch/mips/bcm47xx/time.c

    diff --git a/arch/mips/bcm47xx/time.c b/arch/mips/bcm47xx/time.c
    index 5b46510..74224cf 100644
    a b  
    2222 *  675 Mass Ave, Cambridge, MA 02139, USA.
    2323 */
    2424
    25 
    2625#include <linux/init.h>
    2726#include <linux/ssb/ssb.h>
    2827#include <asm/time.h>
Note: See TracBrowser for help on using the repository browser.