Skip to content

Commit

Permalink
Merge tag 'scmi-fixes-5.18' of git://git.kernel.org/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/git/sudeep.holla/linux into arm/fixes

Arm SCMI firmware interface fixes for v5.18

Few fixes to address assorted set of issues:
- Erroneous clearing of Tx channel which only platform firmware must do
- Invalid point access pass as parameter to sort() in clock support
- Sparse build warnings in OPTEE transport driver
- Use of deprecated zero-length arrays

* tag 'scmi-fixes-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux:
  firmware: arm_scmi: Fix sparse warnings in OPTEE transport driver
  firmware: arm_scmi: Replace zero-length array with flexible-array member
  firmware: arm_scmi: Fix sorting of retrieved clock rates
  firmware: arm_scmi: Remove clear channel call on the TX channel

Link: https://lore.kernel.org/r/20220407110818.1436181-1-sudeep.holla@arm.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
  • Loading branch information
Arnd Bergmann committed Apr 7, 2022
2 parents caee010 + bf36619 commit f455742
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
5 changes: 3 additions & 2 deletions drivers/firmware/arm_scmi/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct scmi_msg_resp_clock_describe_rates {
struct {
__le32 value_low;
__le32 value_high;
} rate[0];
} rate[];
#define RATE_TO_U64(X) \
({ \
typeof(X) x = (X); \
Expand Down Expand Up @@ -210,7 +210,8 @@ scmi_clock_describe_rates_get(const struct scmi_protocol_handle *ph, u32 clk_id,

if (rate_discrete && rate) {
clk->list.num_rates = tot_rate_cnt;
sort(rate, tot_rate_cnt, sizeof(*rate), rate_cmp_func, NULL);
sort(clk->list.rates, tot_rate_cnt, sizeof(*rate),
rate_cmp_func, NULL);
}

clk->rate_discrete = rate_discrete;
Expand Down
3 changes: 2 additions & 1 deletion drivers/firmware/arm_scmi/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,8 @@ static void scmi_handle_response(struct scmi_chan_info *cinfo,

xfer = scmi_xfer_command_acquire(cinfo, msg_hdr);
if (IS_ERR(xfer)) {
scmi_clear_channel(info, cinfo);
if (MSG_XTRACT_TYPE(msg_hdr) == MSG_TYPE_DELAYED_RESP)
scmi_clear_channel(info, cinfo);
return;
}

Expand Down
8 changes: 4 additions & 4 deletions drivers/firmware/arm_scmi/optee.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,8 @@ static int scmi_optee_chan_free(int id, void *p, void *data)
return 0;
}

static struct scmi_shared_mem *get_channel_shm(struct scmi_optee_channel *chan,
struct scmi_xfer *xfer)
static struct scmi_shared_mem __iomem *
get_channel_shm(struct scmi_optee_channel *chan, struct scmi_xfer *xfer)
{
if (!chan)
return NULL;
Expand All @@ -419,7 +419,7 @@ static int scmi_optee_send_message(struct scmi_chan_info *cinfo,
struct scmi_xfer *xfer)
{
struct scmi_optee_channel *channel = cinfo->transport_info;
struct scmi_shared_mem *shmem = get_channel_shm(channel, xfer);
struct scmi_shared_mem __iomem *shmem = get_channel_shm(channel, xfer);
int ret;

mutex_lock(&channel->mu);
Expand All @@ -436,7 +436,7 @@ static void scmi_optee_fetch_response(struct scmi_chan_info *cinfo,
struct scmi_xfer *xfer)
{
struct scmi_optee_channel *channel = cinfo->transport_info;
struct scmi_shared_mem *shmem = get_channel_shm(channel, xfer);
struct scmi_shared_mem __iomem *shmem = get_channel_shm(channel, xfer);

shmem_fetch_response(shmem, xfer);
}
Expand Down

0 comments on commit f455742

Please sign in to comment.