* [PATCH 1/4] thunderbolt: Add casts to prevent endianness warnings
@ 2014-06-20 19:42 Andreas Noever
2014-06-20 19:42 ` [PATCH 2/4] thunderbolt: Fix header declaration of tb_find_cap Andreas Noever
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Andreas Noever @ 2014-06-20 19:42 UTC (permalink / raw)
To: linux-kernel, Greg KH; +Cc: Andreas Noever
Thunderbolt packets are big endian. Cast pkg->buffer to __be32* when
accessing the checksum.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Andreas Noever <andreas.noever@gmail.com>
---
drivers/thunderbolt/ctl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/thunderbolt/ctl.c b/drivers/thunderbolt/ctl.c
index 4c6da92..799634b 100644
--- a/drivers/thunderbolt/ctl.c
+++ b/drivers/thunderbolt/ctl.c
@@ -355,7 +355,7 @@ static int tb_ctl_tx(struct tb_ctl *ctl, void *data, size_t len,
pkg->frame.sof = type;
pkg->frame.eof = type;
cpu_to_be32_array(pkg->buffer, data, len / 4);
- *(u32 *) (pkg->buffer + len) = tb_crc(pkg->buffer, len);
+ *(__be32 *) (pkg->buffer + len) = tb_crc(pkg->buffer, len);
res = ring_tx(ctl->tx, &pkg->frame);
if (res) /* ring is stopped */
@@ -412,7 +412,7 @@ static void tb_ctl_rx_callback(struct tb_ring *ring, struct ring_frame *frame,
}
frame->size -= 4; /* remove checksum */
- if (*(u32 *) (pkg->buffer + frame->size)
+ if (*(__be32 *) (pkg->buffer + frame->size)
!= tb_crc(pkg->buffer, frame->size)) {
tb_ctl_err(pkg->ctl,
"RX: checksum mismatch, dropping packet\n");
--
2.0.0
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 2/4] thunderbolt: Fix header declaration of tb_find_cap
2014-06-20 19:42 [PATCH 1/4] thunderbolt: Add casts to prevent endianness warnings Andreas Noever
@ 2014-06-20 19:42 ` Andreas Noever
2014-06-20 19:42 ` [PATCH 3/4] thunderbolt: Make enum tb_drom_entry_type unsigned Andreas Noever
2014-06-20 19:42 ` [PATCH 4/4] thunderbolt: Make tb_eeprom_get_drom_offset static Andreas Noever
2 siblings, 0 replies; 4+ messages in thread
From: Andreas Noever @ 2014-06-20 19:42 UTC (permalink / raw)
To: linux-kernel, Greg KH; +Cc: Andreas Noever
tb_find_cap in cap.c takes an enum tb_cap and not an u32. Fix the
declaration in tb.h.
Signed-off-by: Andreas Noever <andreas.noever@gmail.com>
---
drivers/thunderbolt/tb.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h
index 18ade5e..8b0d7cf 100644
--- a/drivers/thunderbolt/tb.h
+++ b/drivers/thunderbolt/tb.h
@@ -233,7 +233,7 @@ int tb_wait_for_port(struct tb_port *port, bool wait_if_unplugged);
int tb_port_add_nfc_credits(struct tb_port *port, int credits);
int tb_port_clear_counter(struct tb_port *port, int counter);
-int tb_find_cap(struct tb_port *port, enum tb_cfg_space space, u32 value);
+int tb_find_cap(struct tb_port *port, enum tb_cfg_space space, enum tb_cap cap);
struct tb_path *tb_path_alloc(struct tb *tb, int num_hops);
void tb_path_free(struct tb_path *path);
--
2.0.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 3/4] thunderbolt: Make enum tb_drom_entry_type unsigned
2014-06-20 19:42 [PATCH 1/4] thunderbolt: Add casts to prevent endianness warnings Andreas Noever
2014-06-20 19:42 ` [PATCH 2/4] thunderbolt: Fix header declaration of tb_find_cap Andreas Noever
@ 2014-06-20 19:42 ` Andreas Noever
2014-06-20 19:42 ` [PATCH 4/4] thunderbolt: Make tb_eeprom_get_drom_offset static Andreas Noever
2 siblings, 0 replies; 4+ messages in thread
From: Andreas Noever @ 2014-06-20 19:42 UTC (permalink / raw)
To: linux-kernel, Greg KH; +Cc: Andreas Noever
Force enum tb_drom_entry_type to unsigned to fix the following error:
drivers/thunderbolt/eeprom.c:202:39: error: dubious one-bit signed bitfield
Signed-off-by: Andreas Noever <andreas.noever@gmail.com>
---
drivers/thunderbolt/eeprom.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/thunderbolt/eeprom.c b/drivers/thunderbolt/eeprom.c
index b133f3f..71f719b 100644
--- a/drivers/thunderbolt/eeprom.c
+++ b/drivers/thunderbolt/eeprom.c
@@ -191,7 +191,8 @@ struct tb_drom_header {
} __packed;
enum tb_drom_entry_type {
- TB_DROM_ENTRY_GENERIC,
+ /* force unsigned to prevent "one-bit signed bitfield" warning */
+ TB_DROM_ENTRY_GENERIC = 0U,
TB_DROM_ENTRY_PORT,
};
--
2.0.0
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 4/4] thunderbolt: Make tb_eeprom_get_drom_offset static
2014-06-20 19:42 [PATCH 1/4] thunderbolt: Add casts to prevent endianness warnings Andreas Noever
2014-06-20 19:42 ` [PATCH 2/4] thunderbolt: Fix header declaration of tb_find_cap Andreas Noever
2014-06-20 19:42 ` [PATCH 3/4] thunderbolt: Make enum tb_drom_entry_type unsigned Andreas Noever
@ 2014-06-20 19:42 ` Andreas Noever
2 siblings, 0 replies; 4+ messages in thread
From: Andreas Noever @ 2014-06-20 19:42 UTC (permalink / raw)
To: linux-kernel, Greg KH; +Cc: Andreas Noever
tb_eeprom_get_drom_offset is local to this file.
Signed-off-by: Andreas Noever <andreas.noever@gmail.com>
---
drivers/thunderbolt/eeprom.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/thunderbolt/eeprom.c b/drivers/thunderbolt/eeprom.c
index 71f719b..0dde34e 100644
--- a/drivers/thunderbolt/eeprom.c
+++ b/drivers/thunderbolt/eeprom.c
@@ -233,7 +233,7 @@ struct tb_drom_entry_port {
/**
* tb_eeprom_get_drom_offset - get drom offset within eeprom
*/
-int tb_eeprom_get_drom_offset(struct tb_switch *sw, u16 *offset)
+static int tb_eeprom_get_drom_offset(struct tb_switch *sw, u16 *offset)
{
struct tb_cap_plug_events cap;
int res;
--
2.0.0
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-06-20 19:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-20 19:42 [PATCH 1/4] thunderbolt: Add casts to prevent endianness warnings Andreas Noever
2014-06-20 19:42 ` [PATCH 2/4] thunderbolt: Fix header declaration of tb_find_cap Andreas Noever
2014-06-20 19:42 ` [PATCH 3/4] thunderbolt: Make enum tb_drom_entry_type unsigned Andreas Noever
2014-06-20 19:42 ` [PATCH 4/4] thunderbolt: Make tb_eeprom_get_drom_offset static Andreas Noever
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome