Skip to content

Commit

Permalink
net: dsa: b53: constify b53_io_ops structures
Browse files Browse the repository at this point in the history
The b53_io_ops structures are never modified, so declare them as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Julia Lawall authored and David S. Miller committed Aug 9, 2016
1 parent 631fee7 commit 0dff88d
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion drivers/net/dsa/b53/b53_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1681,7 +1681,8 @@ static int b53_switch_init(struct b53_device *dev)
return 0;
}

struct b53_device *b53_switch_alloc(struct device *base, struct b53_io_ops *ops,
struct b53_device *b53_switch_alloc(struct device *base,
const struct b53_io_ops *ops,
void *priv)
{
struct dsa_switch *ds;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/dsa/b53/b53_mdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ static int b53_mdio_phy_write16(struct b53_device *dev, int addr, int reg,
return mdiobus_write_nested(bus, addr, reg, value);
}

static struct b53_io_ops b53_mdio_ops = {
static const struct b53_io_ops b53_mdio_ops = {
.read8 = b53_mdio_read8,
.read16 = b53_mdio_read16,
.read32 = b53_mdio_read32,
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/dsa/b53/b53_mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ static int b53_mmap_write64(struct b53_device *dev, u8 page, u8 reg,
return 0;
}

static struct b53_io_ops b53_mmap_ops = {
static const struct b53_io_ops b53_mmap_ops = {
.read8 = b53_mmap_read8,
.read16 = b53_mmap_read16,
.read32 = b53_mmap_read32,
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/dsa/b53/b53_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ static inline int is_cpu_port(struct b53_device *dev, int port)
return dev->cpu_port;
}

struct b53_device *b53_switch_alloc(struct device *base, struct b53_io_ops *ops,
struct b53_device *b53_switch_alloc(struct device *base,
const struct b53_io_ops *ops,
void *priv);

int b53_switch_detect(struct b53_device *dev);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/dsa/b53/b53_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ static int b53_spi_write64(struct b53_device *dev, u8 page, u8 reg, u64 value)
return spi_write(spi, txbuf, sizeof(txbuf));
}

static struct b53_io_ops b53_spi_ops = {
static const struct b53_io_ops b53_spi_ops = {
.read8 = b53_spi_read8,
.read16 = b53_spi_read16,
.read32 = b53_spi_read32,
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/dsa/b53/b53_srab.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ static int b53_srab_write64(struct b53_device *dev, u8 page, u8 reg,
return ret;
}

static struct b53_io_ops b53_srab_ops = {
static const struct b53_io_ops b53_srab_ops = {
.read8 = b53_srab_read8,
.read16 = b53_srab_read16,
.read32 = b53_srab_read32,
Expand Down

0 comments on commit 0dff88d

Please sign in to comment.