mei: constify passed buffers and structures
Buffers and structures passed to MEI bus and client API can be made const for safer code and clear indication that it is not modified. Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> Link: https://lore.kernel.org/r/20210729102803.46289-1-krzysztof.kozlowski@canonical.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
9bb3a9dddb
commit
0912ef4855
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* Return: written size bytes or < 0 on error
|
||||
*/
|
||||
ssize_t __mei_cl_send(struct mei_cl *cl, u8 *buf, size_t length, u8 vtag,
|
||||
ssize_t __mei_cl_send(struct mei_cl *cl, const u8 *buf, size_t length, u8 vtag,
|
||||
unsigned int mode)
|
||||
{
|
||||
struct mei_device *bus;
|
||||
|
@ -232,8 +232,8 @@ out:
|
|||
* * < 0 on error
|
||||
*/
|
||||
|
||||
ssize_t mei_cldev_send_vtag(struct mei_cl_device *cldev, u8 *buf, size_t length,
|
||||
u8 vtag)
|
||||
ssize_t mei_cldev_send_vtag(struct mei_cl_device *cldev, const u8 *buf,
|
||||
size_t length, u8 vtag)
|
||||
{
|
||||
struct mei_cl *cl = cldev->cl;
|
||||
|
||||
|
@ -296,7 +296,7 @@ EXPORT_SYMBOL_GPL(mei_cldev_recv_nonblock_vtag);
|
|||
* * written size in bytes
|
||||
* * < 0 on error
|
||||
*/
|
||||
ssize_t mei_cldev_send(struct mei_cl_device *cldev, u8 *buf, size_t length)
|
||||
ssize_t mei_cldev_send(struct mei_cl_device *cldev, const u8 *buf, size_t length)
|
||||
{
|
||||
return mei_cldev_send_vtag(cldev, buf, length, 0);
|
||||
}
|
||||
|
@ -552,7 +552,7 @@ EXPORT_SYMBOL_GPL(mei_cldev_ver);
|
|||
*
|
||||
* Return: true if me client is initialized and connected
|
||||
*/
|
||||
bool mei_cldev_enabled(struct mei_cl_device *cldev)
|
||||
bool mei_cldev_enabled(const struct mei_cl_device *cldev)
|
||||
{
|
||||
return mei_cl_is_connected(cldev->cl);
|
||||
}
|
||||
|
@ -771,8 +771,8 @@ EXPORT_SYMBOL_GPL(mei_cldev_disable);
|
|||
* Return: id on success; NULL if no id is matching
|
||||
*/
|
||||
static const
|
||||
struct mei_cl_device_id *mei_cl_device_find(struct mei_cl_device *cldev,
|
||||
struct mei_cl_driver *cldrv)
|
||||
struct mei_cl_device_id *mei_cl_device_find(const struct mei_cl_device *cldev,
|
||||
const struct mei_cl_driver *cldrv)
|
||||
{
|
||||
const struct mei_cl_device_id *id;
|
||||
const uuid_le *uuid;
|
||||
|
@ -815,8 +815,8 @@ struct mei_cl_device_id *mei_cl_device_find(struct mei_cl_device *cldev,
|
|||
*/
|
||||
static int mei_cl_device_match(struct device *dev, struct device_driver *drv)
|
||||
{
|
||||
struct mei_cl_device *cldev = to_mei_cl_device(dev);
|
||||
struct mei_cl_driver *cldrv = to_mei_cl_driver(drv);
|
||||
const struct mei_cl_device *cldev = to_mei_cl_device(dev);
|
||||
const struct mei_cl_driver *cldrv = to_mei_cl_driver(drv);
|
||||
const struct mei_cl_device_id *found_id;
|
||||
|
||||
if (!cldev)
|
||||
|
|
|
@ -160,7 +160,7 @@ int mei_cl_vt_support_check(const struct mei_cl *cl);
|
|||
*
|
||||
* Return: true if the host client is connected
|
||||
*/
|
||||
static inline bool mei_cl_is_connected(struct mei_cl *cl)
|
||||
static inline bool mei_cl_is_connected(const struct mei_cl *cl)
|
||||
{
|
||||
return cl->state == MEI_FILE_CONNECTED;
|
||||
}
|
||||
|
|
|
@ -356,7 +356,7 @@ struct mei_hw_ops {
|
|||
/* MEI bus API*/
|
||||
void mei_cl_bus_rescan_work(struct work_struct *work);
|
||||
void mei_cl_bus_dev_fixup(struct mei_cl_device *dev);
|
||||
ssize_t __mei_cl_send(struct mei_cl *cl, u8 *buf, size_t length, u8 vtag,
|
||||
ssize_t __mei_cl_send(struct mei_cl *cl, const u8 *buf, size_t length, u8 vtag,
|
||||
unsigned int mode);
|
||||
ssize_t __mei_cl_recv(struct mei_cl *cl, u8 *buf, size_t length, u8 *vtag,
|
||||
unsigned int mode, unsigned long timeout);
|
||||
|
|
|
@ -91,12 +91,13 @@ void mei_cldev_driver_unregister(struct mei_cl_driver *cldrv);
|
|||
mei_cldev_driver_register,\
|
||||
mei_cldev_driver_unregister)
|
||||
|
||||
ssize_t mei_cldev_send(struct mei_cl_device *cldev, u8 *buf, size_t length);
|
||||
ssize_t mei_cldev_send(struct mei_cl_device *cldev, const u8 *buf,
|
||||
size_t length);
|
||||
ssize_t mei_cldev_recv(struct mei_cl_device *cldev, u8 *buf, size_t length);
|
||||
ssize_t mei_cldev_recv_nonblock(struct mei_cl_device *cldev, u8 *buf,
|
||||
size_t length);
|
||||
ssize_t mei_cldev_send_vtag(struct mei_cl_device *cldev, u8 *buf, size_t length,
|
||||
u8 vtag);
|
||||
ssize_t mei_cldev_send_vtag(struct mei_cl_device *cldev, const u8 *buf,
|
||||
size_t length, u8 vtag);
|
||||
ssize_t mei_cldev_recv_vtag(struct mei_cl_device *cldev, u8 *buf, size_t length,
|
||||
u8 *vtag);
|
||||
ssize_t mei_cldev_recv_nonblock_vtag(struct mei_cl_device *cldev, u8 *buf,
|
||||
|
@ -114,6 +115,6 @@ void mei_cldev_set_drvdata(struct mei_cl_device *cldev, void *data);
|
|||
|
||||
int mei_cldev_enable(struct mei_cl_device *cldev);
|
||||
int mei_cldev_disable(struct mei_cl_device *cldev);
|
||||
bool mei_cldev_enabled(struct mei_cl_device *cldev);
|
||||
bool mei_cldev_enabled(const struct mei_cl_device *cldev);
|
||||
|
||||
#endif /* _LINUX_MEI_CL_BUS_H */
|
||||
|
|
Loading…
Reference in New Issue