mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-10 05:39:42 -04:00
media: dvb-usb: Constify struct i2c_algorithm
'struct i2c_algorithm' are not modified in these drivers. Constifying this structure moves some data to a read-only section, so increase overall security, especially when the structure holds some function pointers. More over, dvb_usb_device_properties->i2c_algo seems to only be copied in i2c_adapter->algo, which is already a "const struct i2c_algorithm". This is done in dvb_usb_i2c_init() On a x86_64, with allmodconfig, as an example: Before: ====== text data bss dec hex filename 30571 5916 36 36523 8eab drivers/media/usb/dvb-usb/af9005.o After: ===== text data bss dec hex filename 30667 5852 36 36555 8ecb drivers/media/usb/dvb-usb/af9005.o Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
This commit is contained in:
committed by
Hans Verkuil
parent
4f527a0463
commit
fc91d334e0
@@ -445,7 +445,7 @@ static u32 af9005_i2c_func(struct i2c_adapter *adapter)
|
||||
return I2C_FUNC_I2C;
|
||||
}
|
||||
|
||||
static struct i2c_algorithm af9005_i2c_algo = {
|
||||
static const struct i2c_algorithm af9005_i2c_algo = {
|
||||
.master_xfer = af9005_i2c_xfer,
|
||||
.functionality = af9005_i2c_func,
|
||||
};
|
||||
|
||||
@@ -1062,7 +1062,7 @@ static u32 az6027_i2c_func(struct i2c_adapter *adapter)
|
||||
return I2C_FUNC_I2C;
|
||||
}
|
||||
|
||||
static struct i2c_algorithm az6027_i2c_algo = {
|
||||
static const struct i2c_algorithm az6027_i2c_algo = {
|
||||
.master_xfer = az6027_i2c_xfer,
|
||||
.functionality = az6027_i2c_func,
|
||||
};
|
||||
|
||||
@@ -287,7 +287,7 @@ static u32 cxusb_i2c_func(struct i2c_adapter *adapter)
|
||||
return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
|
||||
}
|
||||
|
||||
static struct i2c_algorithm cxusb_i2c_algo = {
|
||||
static const struct i2c_algorithm cxusb_i2c_algo = {
|
||||
.master_xfer = cxusb_i2c_xfer,
|
||||
.functionality = cxusb_i2c_func,
|
||||
};
|
||||
|
||||
@@ -88,7 +88,7 @@ static u32 digitv_i2c_func(struct i2c_adapter *adapter)
|
||||
return I2C_FUNC_I2C;
|
||||
}
|
||||
|
||||
static struct i2c_algorithm digitv_i2c_algo = {
|
||||
static const struct i2c_algorithm digitv_i2c_algo = {
|
||||
.master_xfer = digitv_i2c_xfer,
|
||||
.functionality = digitv_i2c_func,
|
||||
};
|
||||
|
||||
@@ -97,7 +97,7 @@ static u32 dtv5100_i2c_func(struct i2c_adapter *adapter)
|
||||
return I2C_FUNC_I2C;
|
||||
}
|
||||
|
||||
static struct i2c_algorithm dtv5100_i2c_algo = {
|
||||
static const struct i2c_algorithm dtv5100_i2c_algo = {
|
||||
.master_xfer = dtv5100_i2c_xfer,
|
||||
.functionality = dtv5100_i2c_func,
|
||||
};
|
||||
|
||||
@@ -309,7 +309,7 @@ struct dvb_usb_device_properties {
|
||||
struct dvb_rc core;
|
||||
} rc;
|
||||
|
||||
struct i2c_algorithm *i2c_algo;
|
||||
const struct i2c_algorithm *i2c_algo;
|
||||
|
||||
int generic_bulk_ctrl_endpoint;
|
||||
int generic_bulk_ctrl_endpoint_response;
|
||||
|
||||
@@ -839,37 +839,37 @@ static u32 dw210x_i2c_func(struct i2c_adapter *adapter)
|
||||
return I2C_FUNC_I2C;
|
||||
}
|
||||
|
||||
static struct i2c_algorithm dw2102_i2c_algo = {
|
||||
static const struct i2c_algorithm dw2102_i2c_algo = {
|
||||
.master_xfer = dw2102_i2c_transfer,
|
||||
.functionality = dw210x_i2c_func,
|
||||
};
|
||||
|
||||
static struct i2c_algorithm dw2102_serit_i2c_algo = {
|
||||
static const struct i2c_algorithm dw2102_serit_i2c_algo = {
|
||||
.master_xfer = dw2102_serit_i2c_transfer,
|
||||
.functionality = dw210x_i2c_func,
|
||||
};
|
||||
|
||||
static struct i2c_algorithm dw2102_earda_i2c_algo = {
|
||||
static const struct i2c_algorithm dw2102_earda_i2c_algo = {
|
||||
.master_xfer = dw2102_earda_i2c_transfer,
|
||||
.functionality = dw210x_i2c_func,
|
||||
};
|
||||
|
||||
static struct i2c_algorithm dw2104_i2c_algo = {
|
||||
static const struct i2c_algorithm dw2104_i2c_algo = {
|
||||
.master_xfer = dw2104_i2c_transfer,
|
||||
.functionality = dw210x_i2c_func,
|
||||
};
|
||||
|
||||
static struct i2c_algorithm dw3101_i2c_algo = {
|
||||
static const struct i2c_algorithm dw3101_i2c_algo = {
|
||||
.master_xfer = dw3101_i2c_transfer,
|
||||
.functionality = dw210x_i2c_func,
|
||||
};
|
||||
|
||||
static struct i2c_algorithm s6x0_i2c_algo = {
|
||||
static const struct i2c_algorithm s6x0_i2c_algo = {
|
||||
.master_xfer = s6x0_i2c_transfer,
|
||||
.functionality = dw210x_i2c_func,
|
||||
};
|
||||
|
||||
static struct i2c_algorithm su3000_i2c_algo = {
|
||||
static const struct i2c_algorithm su3000_i2c_algo = {
|
||||
.master_xfer = su3000_i2c_transfer,
|
||||
.functionality = dw210x_i2c_func,
|
||||
};
|
||||
|
||||
@@ -319,7 +319,7 @@ static u32 m920x_i2c_func(struct i2c_adapter *adapter)
|
||||
return I2C_FUNC_I2C;
|
||||
}
|
||||
|
||||
static struct i2c_algorithm m920x_i2c_algo = {
|
||||
static const struct i2c_algorithm m920x_i2c_algo = {
|
||||
.master_xfer = m920x_i2c_xfer,
|
||||
.functionality = m920x_i2c_func,
|
||||
};
|
||||
|
||||
@@ -155,7 +155,7 @@ static u32 opera1_i2c_func(struct i2c_adapter *adapter)
|
||||
return I2C_FUNC_I2C;
|
||||
}
|
||||
|
||||
static struct i2c_algorithm opera1_i2c_algo = {
|
||||
static const struct i2c_algorithm opera1_i2c_algo = {
|
||||
.master_xfer = opera1_i2c_xfer,
|
||||
.functionality = opera1_i2c_func,
|
||||
};
|
||||
|
||||
@@ -906,7 +906,7 @@ static struct stb6100_config stb6100_config = {
|
||||
};
|
||||
|
||||
|
||||
static struct i2c_algorithm pctv452e_i2c_algo = {
|
||||
static const struct i2c_algorithm pctv452e_i2c_algo = {
|
||||
.master_xfer = pctv452e_i2c_xfer,
|
||||
.functionality = pctv452e_i2c_func
|
||||
};
|
||||
|
||||
@@ -199,7 +199,7 @@ static u32 technisat_usb2_i2c_func(struct i2c_adapter *adapter)
|
||||
return I2C_FUNC_I2C;
|
||||
}
|
||||
|
||||
static struct i2c_algorithm technisat_usb2_i2c_algo = {
|
||||
static const struct i2c_algorithm technisat_usb2_i2c_algo = {
|
||||
.master_xfer = technisat_usb2_i2c_xfer,
|
||||
.functionality = technisat_usb2_i2c_func,
|
||||
};
|
||||
|
||||
@@ -434,7 +434,7 @@ static u32 ttusb2_i2c_func(struct i2c_adapter *adapter)
|
||||
return I2C_FUNC_I2C;
|
||||
}
|
||||
|
||||
static struct i2c_algorithm ttusb2_i2c_algo = {
|
||||
static const struct i2c_algorithm ttusb2_i2c_algo = {
|
||||
.master_xfer = ttusb2_i2c_xfer,
|
||||
.functionality = ttusb2_i2c_func,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user