thunderbolt: Use const buffer pointer in write operations
authorMika Westerberg <mika.westerberg@linux.intel.com>
Tue, 6 Jun 2017 12:24:53 +0000 (15:24 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 Jun 2017 09:42:40 +0000 (11:42 +0200)
These functions should not (and do not) modify the argument in any way
so make it const.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Yehezkel Bernat <yehezkel.bernat@intel.com>
Reviewed-by: Michael Jamet <michael.jamet@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andreas Noever <andreas.noever@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/thunderbolt/ctl.c
drivers/thunderbolt/ctl.h
drivers/thunderbolt/tb.h

index 1146ff4210a9345eb349e742e6f192f2a5451475..1031d97407a8a4fb065f69ce8234e2c5efd14c6d 100644 (file)
@@ -273,7 +273,7 @@ static void tb_cfg_print_error(struct tb_ctl *ctl,
        }
 }
 
-static void cpu_to_be32_array(__be32 *dst, u32 *src, size_t len)
+static void cpu_to_be32_array(__be32 *dst, const u32 *src, size_t len)
 {
        int i;
        for (i = 0; i < len; i++)
@@ -333,7 +333,7 @@ static void tb_ctl_tx_callback(struct tb_ring *ring, struct ring_frame *frame,
  *
  * Return: Returns 0 on success or an error code on failure.
  */
-static int tb_ctl_tx(struct tb_ctl *ctl, void *data, size_t len,
+static int tb_ctl_tx(struct tb_ctl *ctl, const void *data, size_t len,
                     enum tb_cfg_pkg_type type)
 {
        int res;
@@ -650,7 +650,7 @@ struct tb_cfg_result tb_cfg_read_raw(struct tb_ctl *ctl, void *buffer,
  *
  * Offset and length are in dwords.
  */
-struct tb_cfg_result tb_cfg_write_raw(struct tb_ctl *ctl, void *buffer,
+struct tb_cfg_result tb_cfg_write_raw(struct tb_ctl *ctl, const void *buffer,
                u64 route, u32 port, enum tb_cfg_space space,
                u32 offset, u32 length, int timeout_msec)
 {
@@ -695,7 +695,7 @@ int tb_cfg_read(struct tb_ctl *ctl, void *buffer, u64 route, u32 port,
        return res.err;
 }
 
-int tb_cfg_write(struct tb_ctl *ctl, void *buffer, u64 route, u32 port,
+int tb_cfg_write(struct tb_ctl *ctl, const void *buffer, u64 route, u32 port,
                 enum tb_cfg_space space, u32 offset, u32 length)
 {
        struct tb_cfg_result res = tb_cfg_write_raw(ctl, buffer, route, port,
index ba87d6e731dd03d778e9dcaa5255c6b577ff0c45..83ae54947082eeac1c207b6cab78ebb8bdae3bcd 100644 (file)
@@ -61,13 +61,13 @@ struct tb_cfg_result tb_cfg_read_raw(struct tb_ctl *ctl, void *buffer,
                                     u64 route, u32 port,
                                     enum tb_cfg_space space, u32 offset,
                                     u32 length, int timeout_msec);
-struct tb_cfg_result tb_cfg_write_raw(struct tb_ctl *ctl, void *buffer,
+struct tb_cfg_result tb_cfg_write_raw(struct tb_ctl *ctl, const void *buffer,
                                      u64 route, u32 port,
                                      enum tb_cfg_space space, u32 offset,
                                      u32 length, int timeout_msec);
 int tb_cfg_read(struct tb_ctl *ctl, void *buffer, u64 route, u32 port,
                enum tb_cfg_space space, u32 offset, u32 length);
-int tb_cfg_write(struct tb_ctl *ctl, void *buffer, u64 route, u32 port,
+int tb_cfg_write(struct tb_ctl *ctl, const void *buffer, u64 route, u32 port,
                 enum tb_cfg_space space, u32 offset, u32 length);
 int tb_cfg_get_upstream_port(struct tb_ctl *ctl, u64 route);
 
index 61d57ba64035752f9b73e90082c16415de49463f..ba2b857503350b3ca8ed690ad990d490e64917ae 100644 (file)
@@ -173,7 +173,7 @@ static inline int tb_port_read(struct tb_port *port, void *buffer,
                           length);
 }
 
-static inline int tb_port_write(struct tb_port *port, void *buffer,
+static inline int tb_port_write(struct tb_port *port, const void *buffer,
                                enum tb_cfg_space space, u32 offset, u32 length)
 {
        return tb_cfg_write(port->sw->tb->ctl,