Commit fe0612dc authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

mlxsw: item: Make struct mlxsw_item args const

These should be const, so enforce it.
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Acked-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 67dc1596
...@@ -55,7 +55,7 @@ struct mlxsw_item { ...@@ -55,7 +55,7 @@ struct mlxsw_item {
}; };
static inline unsigned int static inline unsigned int
__mlxsw_item_offset(struct mlxsw_item *item, unsigned short index, __mlxsw_item_offset(const struct mlxsw_item *item, unsigned short index,
size_t typesize) size_t typesize)
{ {
BUG_ON(index && !item->step); BUG_ON(index && !item->step);
...@@ -72,7 +72,7 @@ __mlxsw_item_offset(struct mlxsw_item *item, unsigned short index, ...@@ -72,7 +72,7 @@ __mlxsw_item_offset(struct mlxsw_item *item, unsigned short index,
typesize); typesize);
} }
static inline u16 __mlxsw_item_get16(char *buf, struct mlxsw_item *item, static inline u16 __mlxsw_item_get16(char *buf, const struct mlxsw_item *item,
unsigned short index) unsigned short index)
{ {
unsigned int offset = __mlxsw_item_offset(item, index, sizeof(u16)); unsigned int offset = __mlxsw_item_offset(item, index, sizeof(u16));
...@@ -87,7 +87,7 @@ static inline u16 __mlxsw_item_get16(char *buf, struct mlxsw_item *item, ...@@ -87,7 +87,7 @@ static inline u16 __mlxsw_item_get16(char *buf, struct mlxsw_item *item,
return tmp; return tmp;
} }
static inline void __mlxsw_item_set16(char *buf, struct mlxsw_item *item, static inline void __mlxsw_item_set16(char *buf, const struct mlxsw_item *item,
unsigned short index, u16 val) unsigned short index, u16 val)
{ {
unsigned int offset = __mlxsw_item_offset(item, index, unsigned int offset = __mlxsw_item_offset(item, index,
...@@ -105,7 +105,7 @@ static inline void __mlxsw_item_set16(char *buf, struct mlxsw_item *item, ...@@ -105,7 +105,7 @@ static inline void __mlxsw_item_set16(char *buf, struct mlxsw_item *item,
b[offset] = cpu_to_be16(tmp); b[offset] = cpu_to_be16(tmp);
} }
static inline u32 __mlxsw_item_get32(char *buf, struct mlxsw_item *item, static inline u32 __mlxsw_item_get32(char *buf, const struct mlxsw_item *item,
unsigned short index) unsigned short index)
{ {
unsigned int offset = __mlxsw_item_offset(item, index, sizeof(u32)); unsigned int offset = __mlxsw_item_offset(item, index, sizeof(u32));
...@@ -120,7 +120,7 @@ static inline u32 __mlxsw_item_get32(char *buf, struct mlxsw_item *item, ...@@ -120,7 +120,7 @@ static inline u32 __mlxsw_item_get32(char *buf, struct mlxsw_item *item,
return tmp; return tmp;
} }
static inline void __mlxsw_item_set32(char *buf, struct mlxsw_item *item, static inline void __mlxsw_item_set32(char *buf, const struct mlxsw_item *item,
unsigned short index, u32 val) unsigned short index, u32 val)
{ {
unsigned int offset = __mlxsw_item_offset(item, index, unsigned int offset = __mlxsw_item_offset(item, index,
...@@ -138,7 +138,7 @@ static inline void __mlxsw_item_set32(char *buf, struct mlxsw_item *item, ...@@ -138,7 +138,7 @@ static inline void __mlxsw_item_set32(char *buf, struct mlxsw_item *item,
b[offset] = cpu_to_be32(tmp); b[offset] = cpu_to_be32(tmp);
} }
static inline u64 __mlxsw_item_get64(char *buf, struct mlxsw_item *item, static inline u64 __mlxsw_item_get64(char *buf, const struct mlxsw_item *item,
unsigned short index) unsigned short index)
{ {
unsigned int offset = __mlxsw_item_offset(item, index, sizeof(u64)); unsigned int offset = __mlxsw_item_offset(item, index, sizeof(u64));
...@@ -153,7 +153,7 @@ static inline u64 __mlxsw_item_get64(char *buf, struct mlxsw_item *item, ...@@ -153,7 +153,7 @@ static inline u64 __mlxsw_item_get64(char *buf, struct mlxsw_item *item,
return tmp; return tmp;
} }
static inline void __mlxsw_item_set64(char *buf, struct mlxsw_item *item, static inline void __mlxsw_item_set64(char *buf, const struct mlxsw_item *item,
unsigned short index, u64 val) unsigned short index, u64 val)
{ {
unsigned int offset = __mlxsw_item_offset(item, index, sizeof(u64)); unsigned int offset = __mlxsw_item_offset(item, index, sizeof(u64));
...@@ -171,7 +171,7 @@ static inline void __mlxsw_item_set64(char *buf, struct mlxsw_item *item, ...@@ -171,7 +171,7 @@ static inline void __mlxsw_item_set64(char *buf, struct mlxsw_item *item,
} }
static inline void __mlxsw_item_memcpy_from(char *buf, char *dst, static inline void __mlxsw_item_memcpy_from(char *buf, char *dst,
struct mlxsw_item *item, const struct mlxsw_item *item,
unsigned short index) unsigned short index)
{ {
unsigned int offset = __mlxsw_item_offset(item, index, sizeof(char)); unsigned int offset = __mlxsw_item_offset(item, index, sizeof(char));
...@@ -180,7 +180,7 @@ static inline void __mlxsw_item_memcpy_from(char *buf, char *dst, ...@@ -180,7 +180,7 @@ static inline void __mlxsw_item_memcpy_from(char *buf, char *dst,
} }
static inline void __mlxsw_item_memcpy_to(char *buf, const char *src, static inline void __mlxsw_item_memcpy_to(char *buf, const char *src,
struct mlxsw_item *item, const struct mlxsw_item *item,
unsigned short index) unsigned short index)
{ {
unsigned int offset = __mlxsw_item_offset(item, index, sizeof(char)); unsigned int offset = __mlxsw_item_offset(item, index, sizeof(char));
...@@ -189,7 +189,8 @@ static inline void __mlxsw_item_memcpy_to(char *buf, const char *src, ...@@ -189,7 +189,8 @@ static inline void __mlxsw_item_memcpy_to(char *buf, const char *src,
} }
static inline u16 static inline u16
__mlxsw_item_bit_array_offset(struct mlxsw_item *item, u16 index, u8 *shift) __mlxsw_item_bit_array_offset(const struct mlxsw_item *item,
u16 index, u8 *shift)
{ {
u16 max_index, be_index; u16 max_index, be_index;
u16 offset; /* byte offset inside the array */ u16 offset; /* byte offset inside the array */
...@@ -212,7 +213,8 @@ __mlxsw_item_bit_array_offset(struct mlxsw_item *item, u16 index, u8 *shift) ...@@ -212,7 +213,8 @@ __mlxsw_item_bit_array_offset(struct mlxsw_item *item, u16 index, u8 *shift)
return item->offset + offset; return item->offset + offset;
} }
static inline u8 __mlxsw_item_bit_array_get(char *buf, struct mlxsw_item *item, static inline u8 __mlxsw_item_bit_array_get(char *buf,
const struct mlxsw_item *item,
u16 index) u16 index)
{ {
u8 shift, tmp; u8 shift, tmp;
...@@ -224,7 +226,8 @@ static inline u8 __mlxsw_item_bit_array_get(char *buf, struct mlxsw_item *item, ...@@ -224,7 +226,8 @@ static inline u8 __mlxsw_item_bit_array_get(char *buf, struct mlxsw_item *item,
return tmp; return tmp;
} }
static inline void __mlxsw_item_bit_array_set(char *buf, struct mlxsw_item *item, static inline void __mlxsw_item_bit_array_set(char *buf,
const struct mlxsw_item *item,
u16 index, u8 val) u16 index, u8 val)
{ {
u8 shift, tmp; u8 shift, tmp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment