mirror of https://gitee.com/openkylin/linux.git
net: ipa: introduce gsi_channel_initialized()
Create a simple helper function that indicates whether a channel has been initialized. This abstacts/hides the details of how this is determined. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
a266ad6b5d
commit
6170b6dab2
|
@ -175,6 +175,12 @@ static u32 gsi_channel_id(struct gsi_channel *channel)
|
||||||
return channel - &channel->gsi->channel[0];
|
return channel - &channel->gsi->channel[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* An initialized channel has a non-null GSI pointer */
|
||||||
|
static bool gsi_channel_initialized(struct gsi_channel *channel)
|
||||||
|
{
|
||||||
|
return !!channel->gsi;
|
||||||
|
}
|
||||||
|
|
||||||
/* Update the GSI IRQ type register with the cached value */
|
/* Update the GSI IRQ type register with the cached value */
|
||||||
static void gsi_irq_type_update(struct gsi *gsi, u32 val)
|
static void gsi_irq_type_update(struct gsi *gsi, u32 val)
|
||||||
{
|
{
|
||||||
|
@ -1638,8 +1644,8 @@ static int gsi_channel_setup_one(struct gsi *gsi, u32 channel_id)
|
||||||
u32 evt_ring_id = channel->evt_ring_id;
|
u32 evt_ring_id = channel->evt_ring_id;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!channel->gsi)
|
if (!gsi_channel_initialized(channel))
|
||||||
return 0; /* Ignore uninitialized channels */
|
return 0;
|
||||||
|
|
||||||
ret = gsi_evt_ring_alloc_command(gsi, evt_ring_id);
|
ret = gsi_evt_ring_alloc_command(gsi, evt_ring_id);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -1675,8 +1681,8 @@ static void gsi_channel_teardown_one(struct gsi *gsi, u32 channel_id)
|
||||||
struct gsi_channel *channel = &gsi->channel[channel_id];
|
struct gsi_channel *channel = &gsi->channel[channel_id];
|
||||||
u32 evt_ring_id = channel->evt_ring_id;
|
u32 evt_ring_id = channel->evt_ring_id;
|
||||||
|
|
||||||
if (!channel->gsi)
|
if (!gsi_channel_initialized(channel))
|
||||||
return; /* Ignore uninitialized channels */
|
return;
|
||||||
|
|
||||||
netif_napi_del(&channel->napi);
|
netif_napi_del(&channel->napi);
|
||||||
|
|
||||||
|
@ -1770,8 +1776,8 @@ static int gsi_channel_setup(struct gsi *gsi)
|
||||||
while (channel_id < GSI_CHANNEL_COUNT_MAX) {
|
while (channel_id < GSI_CHANNEL_COUNT_MAX) {
|
||||||
struct gsi_channel *channel = &gsi->channel[channel_id++];
|
struct gsi_channel *channel = &gsi->channel[channel_id++];
|
||||||
|
|
||||||
if (!channel->gsi)
|
if (!gsi_channel_initialized(channel))
|
||||||
continue; /* Ignore uninitialized channels */
|
continue;
|
||||||
|
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
dev_err(gsi->dev, "channel %u not supported by hardware\n",
|
dev_err(gsi->dev, "channel %u not supported by hardware\n",
|
||||||
|
@ -2089,8 +2095,8 @@ static int gsi_channel_init_one(struct gsi *gsi,
|
||||||
/* Inverse of gsi_channel_init_one() */
|
/* Inverse of gsi_channel_init_one() */
|
||||||
static void gsi_channel_exit_one(struct gsi_channel *channel)
|
static void gsi_channel_exit_one(struct gsi_channel *channel)
|
||||||
{
|
{
|
||||||
if (!channel->gsi)
|
if (!gsi_channel_initialized(channel))
|
||||||
return; /* Ignore uninitialized channels */
|
return;
|
||||||
|
|
||||||
if (channel->command)
|
if (channel->command)
|
||||||
ipa_cmd_pool_exit(channel);
|
ipa_cmd_pool_exit(channel);
|
||||||
|
|
Loading…
Reference in New Issue