Skip to content

Commit 0dff88d

Browse files
JuliaLawalldavem330
authored andcommitted
net: dsa: b53: constify b53_io_ops structures
The b53_io_ops structures are never modified, so declare them as const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall <[email protected]> Acked-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 631fee7 commit 0dff88d

File tree

6 files changed

+8
-6
lines changed

6 files changed

+8
-6
lines changed

drivers/net/dsa/b53/b53_common.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1681,7 +1681,8 @@ static int b53_switch_init(struct b53_device *dev)
16811681
return 0;
16821682
}
16831683

1684-
struct b53_device *b53_switch_alloc(struct device *base, struct b53_io_ops *ops,
1684+
struct b53_device *b53_switch_alloc(struct device *base,
1685+
const struct b53_io_ops *ops,
16851686
void *priv)
16861687
{
16871688
struct dsa_switch *ds;

drivers/net/dsa/b53/b53_mdio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ static int b53_mdio_phy_write16(struct b53_device *dev, int addr, int reg,
267267
return mdiobus_write_nested(bus, addr, reg, value);
268268
}
269269

270-
static struct b53_io_ops b53_mdio_ops = {
270+
static const struct b53_io_ops b53_mdio_ops = {
271271
.read8 = b53_mdio_read8,
272272
.read16 = b53_mdio_read16,
273273
.read32 = b53_mdio_read32,

drivers/net/dsa/b53/b53_mmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ static int b53_mmap_write64(struct b53_device *dev, u8 page, u8 reg,
208208
return 0;
209209
}
210210

211-
static struct b53_io_ops b53_mmap_ops = {
211+
static const struct b53_io_ops b53_mmap_ops = {
212212
.read8 = b53_mmap_read8,
213213
.read16 = b53_mmap_read16,
214214
.read32 = b53_mmap_read32,

drivers/net/dsa/b53/b53_priv.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ static inline int is_cpu_port(struct b53_device *dev, int port)
182182
return dev->cpu_port;
183183
}
184184

185-
struct b53_device *b53_switch_alloc(struct device *base, struct b53_io_ops *ops,
185+
struct b53_device *b53_switch_alloc(struct device *base,
186+
const struct b53_io_ops *ops,
186187
void *priv);
187188

188189
int b53_switch_detect(struct b53_device *dev);

drivers/net/dsa/b53/b53_spi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ static int b53_spi_write64(struct b53_device *dev, u8 page, u8 reg, u64 value)
270270
return spi_write(spi, txbuf, sizeof(txbuf));
271271
}
272272

273-
static struct b53_io_ops b53_spi_ops = {
273+
static const struct b53_io_ops b53_spi_ops = {
274274
.read8 = b53_spi_read8,
275275
.read16 = b53_spi_read16,
276276
.read32 = b53_spi_read32,

drivers/net/dsa/b53/b53_srab.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ static int b53_srab_write64(struct b53_device *dev, u8 page, u8 reg,
344344
return ret;
345345
}
346346

347-
static struct b53_io_ops b53_srab_ops = {
347+
static const struct b53_io_ops b53_srab_ops = {
348348
.read8 = b53_srab_read8,
349349
.read16 = b53_srab_read16,
350350
.read32 = b53_srab_read32,

0 commit comments

Comments
 (0)