Commit 73ede046 authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Greg Kroah-Hartman

soundwire: bus: fix alignment issues

Use Linux style
Reviewed-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 806a11f0
...@@ -172,7 +172,8 @@ static inline int do_transfer(struct sdw_bus *bus, struct sdw_msg *msg) ...@@ -172,7 +172,8 @@ static inline int do_transfer(struct sdw_bus *bus, struct sdw_msg *msg)
} }
static inline int do_transfer_defer(struct sdw_bus *bus, static inline int do_transfer_defer(struct sdw_bus *bus,
struct sdw_msg *msg, struct sdw_defer *defer) struct sdw_msg *msg,
struct sdw_defer *defer)
{ {
int retry = bus->prop.err_threshold; int retry = bus->prop.err_threshold;
enum sdw_command_response resp; enum sdw_command_response resp;
...@@ -224,7 +225,7 @@ int sdw_transfer(struct sdw_bus *bus, struct sdw_msg *msg) ...@@ -224,7 +225,7 @@ int sdw_transfer(struct sdw_bus *bus, struct sdw_msg *msg)
ret = do_transfer(bus, msg); ret = do_transfer(bus, msg);
if (ret != 0 && ret != -ENODATA) if (ret != 0 && ret != -ENODATA)
dev_err(bus->dev, "trf on Slave %d failed:%d\n", dev_err(bus->dev, "trf on Slave %d failed:%d\n",
msg->dev_num, ret); msg->dev_num, ret);
if (msg->page) if (msg->page)
sdw_reset_page(bus, msg->dev_num); sdw_reset_page(bus, msg->dev_num);
...@@ -243,7 +244,7 @@ int sdw_transfer(struct sdw_bus *bus, struct sdw_msg *msg) ...@@ -243,7 +244,7 @@ int sdw_transfer(struct sdw_bus *bus, struct sdw_msg *msg)
* Caller needs to hold the msg_lock lock while calling this * Caller needs to hold the msg_lock lock while calling this
*/ */
int sdw_transfer_defer(struct sdw_bus *bus, struct sdw_msg *msg, int sdw_transfer_defer(struct sdw_bus *bus, struct sdw_msg *msg,
struct sdw_defer *defer) struct sdw_defer *defer)
{ {
int ret; int ret;
...@@ -253,7 +254,7 @@ int sdw_transfer_defer(struct sdw_bus *bus, struct sdw_msg *msg, ...@@ -253,7 +254,7 @@ int sdw_transfer_defer(struct sdw_bus *bus, struct sdw_msg *msg,
ret = do_transfer_defer(bus, msg, defer); ret = do_transfer_defer(bus, msg, defer);
if (ret != 0 && ret != -ENODATA) if (ret != 0 && ret != -ENODATA)
dev_err(bus->dev, "Defer trf on Slave %d failed:%d\n", dev_err(bus->dev, "Defer trf on Slave %d failed:%d\n",
msg->dev_num, ret); msg->dev_num, ret);
if (msg->page) if (msg->page)
sdw_reset_page(bus, msg->dev_num); sdw_reset_page(bus, msg->dev_num);
...@@ -261,9 +262,8 @@ int sdw_transfer_defer(struct sdw_bus *bus, struct sdw_msg *msg, ...@@ -261,9 +262,8 @@ int sdw_transfer_defer(struct sdw_bus *bus, struct sdw_msg *msg,
return ret; return ret;
} }
int sdw_fill_msg(struct sdw_msg *msg, struct sdw_slave *slave, int sdw_fill_msg(struct sdw_msg *msg, struct sdw_slave *slave,
u32 addr, size_t count, u16 dev_num, u8 flags, u8 *buf) u32 addr, size_t count, u16 dev_num, u8 flags, u8 *buf)
{ {
memset(msg, 0, sizeof(*msg)); memset(msg, 0, sizeof(*msg));
msg->addr = addr; /* addr is 16 bit and truncated here */ msg->addr = addr; /* addr is 16 bit and truncated here */
...@@ -321,7 +321,7 @@ int sdw_nread(struct sdw_slave *slave, u32 addr, size_t count, u8 *val) ...@@ -321,7 +321,7 @@ int sdw_nread(struct sdw_slave *slave, u32 addr, size_t count, u8 *val)
int ret; int ret;
ret = sdw_fill_msg(&msg, slave, addr, count, ret = sdw_fill_msg(&msg, slave, addr, count,
slave->dev_num, SDW_MSG_FLAG_READ, val); slave->dev_num, SDW_MSG_FLAG_READ, val);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -349,7 +349,7 @@ int sdw_nwrite(struct sdw_slave *slave, u32 addr, size_t count, u8 *val) ...@@ -349,7 +349,7 @@ int sdw_nwrite(struct sdw_slave *slave, u32 addr, size_t count, u8 *val)
int ret; int ret;
ret = sdw_fill_msg(&msg, slave, addr, count, ret = sdw_fill_msg(&msg, slave, addr, count,
slave->dev_num, SDW_MSG_FLAG_WRITE, val); slave->dev_num, SDW_MSG_FLAG_WRITE, val);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -456,13 +456,13 @@ static int sdw_assign_device_num(struct sdw_slave *slave) ...@@ -456,13 +456,13 @@ static int sdw_assign_device_num(struct sdw_slave *slave)
mutex_unlock(&slave->bus->bus_lock); mutex_unlock(&slave->bus->bus_lock);
if (dev_num < 0) { if (dev_num < 0) {
dev_err(slave->bus->dev, "Get dev_num failed: %d", dev_err(slave->bus->dev, "Get dev_num failed: %d",
dev_num); dev_num);
return dev_num; return dev_num;
} }
} else { } else {
dev_info(slave->bus->dev, dev_info(slave->bus->dev,
"Slave already registered dev_num:%d", "Slave already registered dev_num:%d",
slave->dev_num); slave->dev_num);
/* Clear the slave->dev_num to transfer message on device 0 */ /* Clear the slave->dev_num to transfer message on device 0 */
dev_num = slave->dev_num; dev_num = slave->dev_num;
...@@ -483,7 +483,7 @@ static int sdw_assign_device_num(struct sdw_slave *slave) ...@@ -483,7 +483,7 @@ static int sdw_assign_device_num(struct sdw_slave *slave)
} }
void sdw_extract_slave_id(struct sdw_bus *bus, void sdw_extract_slave_id(struct sdw_bus *bus,
u64 addr, struct sdw_slave_id *id) u64 addr, struct sdw_slave_id *id)
{ {
dev_dbg(bus->dev, "SDW Slave Addr: %llx", addr); dev_dbg(bus->dev, "SDW Slave Addr: %llx", addr);
...@@ -523,7 +523,7 @@ static int sdw_program_device_num(struct sdw_bus *bus) ...@@ -523,7 +523,7 @@ static int sdw_program_device_num(struct sdw_bus *bus)
/* No Slave, so use raw xfer api */ /* No Slave, so use raw xfer api */
ret = sdw_fill_msg(&msg, NULL, SDW_SCP_DEVID_0, ret = sdw_fill_msg(&msg, NULL, SDW_SCP_DEVID_0,
SDW_NUM_DEV_ID_REGISTERS, 0, SDW_MSG_FLAG_READ, buf); SDW_NUM_DEV_ID_REGISTERS, 0, SDW_MSG_FLAG_READ, buf);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -590,7 +590,7 @@ static int sdw_program_device_num(struct sdw_bus *bus) ...@@ -590,7 +590,7 @@ static int sdw_program_device_num(struct sdw_bus *bus)
} }
static void sdw_modify_slave_status(struct sdw_slave *slave, static void sdw_modify_slave_status(struct sdw_slave *slave,
enum sdw_slave_status status) enum sdw_slave_status status)
{ {
mutex_lock(&slave->bus->bus_lock); mutex_lock(&slave->bus->bus_lock);
slave->status = status; slave->status = status;
...@@ -598,7 +598,7 @@ static void sdw_modify_slave_status(struct sdw_slave *slave, ...@@ -598,7 +598,7 @@ static void sdw_modify_slave_status(struct sdw_slave *slave,
} }
int sdw_configure_dpn_intr(struct sdw_slave *slave, int sdw_configure_dpn_intr(struct sdw_slave *slave,
int port, bool enable, int mask) int port, bool enable, int mask)
{ {
u32 addr; u32 addr;
int ret; int ret;
...@@ -618,7 +618,7 @@ int sdw_configure_dpn_intr(struct sdw_slave *slave, ...@@ -618,7 +618,7 @@ int sdw_configure_dpn_intr(struct sdw_slave *slave,
ret = sdw_update(slave, addr, (mask | SDW_DPN_INT_PORT_READY), val); ret = sdw_update(slave, addr, (mask | SDW_DPN_INT_PORT_READY), val);
if (ret < 0) if (ret < 0)
dev_err(slave->bus->dev, dev_err(slave->bus->dev,
"SDW_DPN_INTMASK write failed:%d", val); "SDW_DPN_INTMASK write failed:%d", val);
return ret; return ret;
} }
...@@ -642,7 +642,7 @@ static int sdw_initialize_slave(struct sdw_slave *slave) ...@@ -642,7 +642,7 @@ static int sdw_initialize_slave(struct sdw_slave *slave)
ret = sdw_update(slave, SDW_SCP_INTMASK1, val, val); ret = sdw_update(slave, SDW_SCP_INTMASK1, val, val);
if (ret < 0) { if (ret < 0) {
dev_err(slave->bus->dev, dev_err(slave->bus->dev,
"SDW_SCP_INTMASK1 write failed:%d", ret); "SDW_SCP_INTMASK1 write failed:%d", ret);
return ret; return ret;
} }
...@@ -657,7 +657,7 @@ static int sdw_initialize_slave(struct sdw_slave *slave) ...@@ -657,7 +657,7 @@ static int sdw_initialize_slave(struct sdw_slave *slave)
ret = sdw_update(slave, SDW_DP0_INTMASK, val, val); ret = sdw_update(slave, SDW_DP0_INTMASK, val, val);
if (ret < 0) { if (ret < 0) {
dev_err(slave->bus->dev, dev_err(slave->bus->dev,
"SDW_DP0_INTMASK read failed:%d", ret); "SDW_DP0_INTMASK read failed:%d", ret);
return val; return val;
} }
...@@ -672,7 +672,7 @@ static int sdw_handle_dp0_interrupt(struct sdw_slave *slave, u8 *slave_status) ...@@ -672,7 +672,7 @@ static int sdw_handle_dp0_interrupt(struct sdw_slave *slave, u8 *slave_status)
status = sdw_read(slave, SDW_DP0_INT); status = sdw_read(slave, SDW_DP0_INT);
if (status < 0) { if (status < 0) {
dev_err(slave->bus->dev, dev_err(slave->bus->dev,
"SDW_DP0_INT read failed:%d", status); "SDW_DP0_INT read failed:%d", status);
return status; return status;
} }
...@@ -735,7 +735,7 @@ static int sdw_handle_dp0_interrupt(struct sdw_slave *slave, u8 *slave_status) ...@@ -735,7 +735,7 @@ static int sdw_handle_dp0_interrupt(struct sdw_slave *slave, u8 *slave_status)
} }
static int sdw_handle_port_interrupt(struct sdw_slave *slave, static int sdw_handle_port_interrupt(struct sdw_slave *slave,
int port, u8 *slave_status) int port, u8 *slave_status)
{ {
u8 clear = 0, impl_int_mask; u8 clear = 0, impl_int_mask;
int status, status2, ret, count = 0; int status, status2, ret, count = 0;
...@@ -748,7 +748,7 @@ static int sdw_handle_port_interrupt(struct sdw_slave *slave, ...@@ -748,7 +748,7 @@ static int sdw_handle_port_interrupt(struct sdw_slave *slave,
status = sdw_read(slave, addr); status = sdw_read(slave, addr);
if (status < 0) { if (status < 0) {
dev_err(slave->bus->dev, dev_err(slave->bus->dev,
"SDW_DPN_INT read failed:%d", status); "SDW_DPN_INT read failed:%d", status);
return status; return status;
} }
...@@ -782,7 +782,7 @@ static int sdw_handle_port_interrupt(struct sdw_slave *slave, ...@@ -782,7 +782,7 @@ static int sdw_handle_port_interrupt(struct sdw_slave *slave,
ret = sdw_write(slave, addr, clear); ret = sdw_write(slave, addr, clear);
if (ret < 0) { if (ret < 0) {
dev_err(slave->bus->dev, dev_err(slave->bus->dev,
"SDW_DPN_INT write failed:%d", ret); "SDW_DPN_INT write failed:%d", ret);
return ret; return ret;
} }
...@@ -790,7 +790,7 @@ static int sdw_handle_port_interrupt(struct sdw_slave *slave, ...@@ -790,7 +790,7 @@ static int sdw_handle_port_interrupt(struct sdw_slave *slave,
status2 = sdw_read(slave, addr); status2 = sdw_read(slave, addr);
if (status2 < 0) { if (status2 < 0) {
dev_err(slave->bus->dev, dev_err(slave->bus->dev,
"SDW_DPN_INT read failed:%d", status2); "SDW_DPN_INT read failed:%d", status2);
return status2; return status2;
} }
status &= status2; status &= status2;
...@@ -821,14 +821,14 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave) ...@@ -821,14 +821,14 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
buf = ret = sdw_read(slave, SDW_SCP_INT1); buf = ret = sdw_read(slave, SDW_SCP_INT1);
if (ret < 0) { if (ret < 0) {
dev_err(slave->bus->dev, dev_err(slave->bus->dev,
"SDW_SCP_INT1 read failed:%d", ret); "SDW_SCP_INT1 read failed:%d", ret);
return ret; return ret;
} }
ret = sdw_nread(slave, SDW_SCP_INTSTAT2, 2, buf2); ret = sdw_nread(slave, SDW_SCP_INTSTAT2, 2, buf2);
if (ret < 0) { if (ret < 0) {
dev_err(slave->bus->dev, dev_err(slave->bus->dev,
"SDW_SCP_INT2/3 read failed:%d", ret); "SDW_SCP_INT2/3 read failed:%d", ret);
return ret; return ret;
} }
...@@ -867,7 +867,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave) ...@@ -867,7 +867,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
port = port >> SDW_REG_SHIFT(SDW_SCP_INT1_PORT0_3); port = port >> SDW_REG_SHIFT(SDW_SCP_INT1_PORT0_3);
for_each_set_bit(bit, &port, 8) { for_each_set_bit(bit, &port, 8) {
sdw_handle_port_interrupt(slave, bit, sdw_handle_port_interrupt(slave, bit,
&port_status[bit]); &port_status[bit]);
} }
...@@ -900,7 +900,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave) ...@@ -900,7 +900,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
(slave->ops->interrupt_callback)) { (slave->ops->interrupt_callback)) {
slave_intr.control_port = clear; slave_intr.control_port = clear;
memcpy(slave_intr.port, &port_status, memcpy(slave_intr.port, &port_status,
sizeof(slave_intr.port)); sizeof(slave_intr.port));
slave->ops->interrupt_callback(slave, &slave_intr); slave->ops->interrupt_callback(slave, &slave_intr);
} }
...@@ -909,7 +909,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave) ...@@ -909,7 +909,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
ret = sdw_write(slave, SDW_SCP_INT1, clear); ret = sdw_write(slave, SDW_SCP_INT1, clear);
if (ret < 0) { if (ret < 0) {
dev_err(slave->bus->dev, dev_err(slave->bus->dev,
"SDW_SCP_INT1 write failed:%d", ret); "SDW_SCP_INT1 write failed:%d", ret);
return ret; return ret;
} }
...@@ -920,14 +920,14 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave) ...@@ -920,14 +920,14 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
_buf = ret = sdw_read(slave, SDW_SCP_INT1); _buf = ret = sdw_read(slave, SDW_SCP_INT1);
if (ret < 0) { if (ret < 0) {
dev_err(slave->bus->dev, dev_err(slave->bus->dev,
"SDW_SCP_INT1 read failed:%d", ret); "SDW_SCP_INT1 read failed:%d", ret);
return ret; return ret;
} }
ret = sdw_nread(slave, SDW_SCP_INTSTAT2, 2, _buf2); ret = sdw_nread(slave, SDW_SCP_INTSTAT2, 2, _buf2);
if (ret < 0) { if (ret < 0) {
dev_err(slave->bus->dev, dev_err(slave->bus->dev,
"SDW_SCP_INT2/3 read failed:%d", ret); "SDW_SCP_INT2/3 read failed:%d", ret);
return ret; return ret;
} }
...@@ -953,7 +953,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave) ...@@ -953,7 +953,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
} }
static int sdw_update_slave_status(struct sdw_slave *slave, static int sdw_update_slave_status(struct sdw_slave *slave,
enum sdw_slave_status status) enum sdw_slave_status status)
{ {
if ((slave->ops) && (slave->ops->update_status)) if ((slave->ops) && (slave->ops->update_status))
return slave->ops->update_status(slave, status); return slave->ops->update_status(slave, status);
...@@ -967,7 +967,7 @@ static int sdw_update_slave_status(struct sdw_slave *slave, ...@@ -967,7 +967,7 @@ static int sdw_update_slave_status(struct sdw_slave *slave,
* @status: Status for all Slave(s) * @status: Status for all Slave(s)
*/ */
int sdw_handle_slave_status(struct sdw_bus *bus, int sdw_handle_slave_status(struct sdw_bus *bus,
enum sdw_slave_status status[]) enum sdw_slave_status status[])
{ {
enum sdw_slave_status prev_status; enum sdw_slave_status prev_status;
struct sdw_slave *slave; struct sdw_slave *slave;
...@@ -1028,7 +1028,7 @@ int sdw_handle_slave_status(struct sdw_bus *bus, ...@@ -1028,7 +1028,7 @@ int sdw_handle_slave_status(struct sdw_bus *bus,
default: default:
dev_err(bus->dev, "Invalid slave %d status:%d", dev_err(bus->dev, "Invalid slave %d status:%d",
i, status[i]); i, status[i]);
break; break;
} }
......
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