Skip to content

Commit cbd3125

Browse files
committed
Merge branch 'net-ipa-a-few-small-fixes'
Alex Elder says: ==================== net: ipa: a few small fixes This series implements some minor bug fixes or improvements. The first patch removes an apparently unnecessary restriction, which results in an error on a 32-bit ARM build. The second makes a definition used for SDM845 match what is used in the downstream code. The third just ensures two netdev pointers are only non-null when valid. The fourth simplifies a little code, knowing that a called function never returns an error. The fifth and sixth just remove some empty/place holder functions. And the last patch fixes a comment, makes a function private, and removes an unnecessary double-negation of a Boolean variable. This patch produces a warning from checkpatch, indicating that a pair of parentheses is unnecessary. I agree with that advice, but it conflicts with a suggestion from the compiler. I left the "problem" in place to avoid the compiler warning. ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 8859a44 + 602a1c7 commit cbd3125

File tree

13 files changed

+49
-153
lines changed

13 files changed

+49
-153
lines changed

drivers/net/ipa/gsi.c

Lines changed: 6 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ static void gsi_irq_type_disable(struct gsi *gsi, enum gsi_irq_type_id type_id)
198198
gsi_irq_type_update(gsi, gsi->type_enabled_bitmap & ~BIT(type_id));
199199
}
200200

201-
/* Turn off all GSI interrupts initially */
201+
/* Turn off all GSI interrupts initially; there is no gsi_irq_teardown() */
202202
static void gsi_irq_setup(struct gsi *gsi)
203203
{
204204
/* Disable all interrupt types */
@@ -217,12 +217,6 @@ static void gsi_irq_setup(struct gsi *gsi)
217217
iowrite32(0, gsi->virt + GSI_CNTXT_GSI_IRQ_EN_OFFSET);
218218
}
219219

220-
/* Turn off all GSI interrupts when we're all done */
221-
static void gsi_irq_teardown(struct gsi *gsi)
222-
{
223-
/* Nothing to do */
224-
}
225-
226220
/* Event ring commands are performed one at a time. Their completion
227221
* is signaled by the event ring control GSI interrupt type, which is
228222
* only enabled when we issue an event ring command. Only the event
@@ -786,7 +780,7 @@ static void gsi_channel_trans_quiesce(struct gsi_channel *channel)
786780
}
787781
}
788782

789-
/* Program a channel for use */
783+
/* Program a channel for use; there is no gsi_channel_deprogram() */
790784
static void gsi_channel_program(struct gsi_channel *channel, bool doorbell)
791785
{
792786
size_t size = channel->tre_ring.count * GSI_RING_ELEMENT_SIZE;
@@ -874,11 +868,6 @@ static void gsi_channel_program(struct gsi_channel *channel, bool doorbell)
874868
/* All done! */
875869
}
876870

877-
static void gsi_channel_deprogram(struct gsi_channel *channel)
878-
{
879-
/* Nothing to do */
880-
}
881-
882871
static int __gsi_channel_start(struct gsi_channel *channel, bool start)
883872
{
884873
struct gsi *gsi = channel->gsi;
@@ -1623,18 +1612,6 @@ static u32 gsi_event_bitmap_init(u32 evt_ring_max)
16231612
return event_bitmap;
16241613
}
16251614

1626-
/* Setup function for event rings */
1627-
static void gsi_evt_ring_setup(struct gsi *gsi)
1628-
{
1629-
/* Nothing to do */
1630-
}
1631-
1632-
/* Inverse of gsi_evt_ring_setup() */
1633-
static void gsi_evt_ring_teardown(struct gsi *gsi)
1634-
{
1635-
/* Nothing to do */
1636-
}
1637-
16381615
/* Setup function for a single channel */
16391616
static int gsi_channel_setup_one(struct gsi *gsi, u32 channel_id)
16401617
{
@@ -1684,7 +1661,6 @@ static void gsi_channel_teardown_one(struct gsi *gsi, u32 channel_id)
16841661

16851662
netif_napi_del(&channel->napi);
16861663

1687-
gsi_channel_deprogram(channel);
16881664
gsi_channel_de_alloc_command(gsi, channel_id);
16891665
gsi_evt_ring_reset_command(gsi, evt_ring_id);
16901666
gsi_evt_ring_de_alloc_command(gsi, evt_ring_id);
@@ -1759,7 +1735,6 @@ static int gsi_channel_setup(struct gsi *gsi)
17591735
u32 mask;
17601736
int ret;
17611737

1762-
gsi_evt_ring_setup(gsi);
17631738
gsi_irq_enable(gsi);
17641739

17651740
mutex_lock(&gsi->mutex);
@@ -1819,7 +1794,6 @@ static int gsi_channel_setup(struct gsi *gsi)
18191794
mutex_unlock(&gsi->mutex);
18201795

18211796
gsi_irq_disable(gsi);
1822-
gsi_evt_ring_teardown(gsi);
18231797

18241798
return ret;
18251799
}
@@ -1848,15 +1822,13 @@ static void gsi_channel_teardown(struct gsi *gsi)
18481822
mutex_unlock(&gsi->mutex);
18491823

18501824
gsi_irq_disable(gsi);
1851-
gsi_evt_ring_teardown(gsi);
18521825
}
18531826

18541827
/* Setup function for GSI. GSI firmware must be loaded and initialized */
18551828
int gsi_setup(struct gsi *gsi)
18561829
{
18571830
struct device *dev = gsi->dev;
18581831
u32 val;
1859-
int ret;
18601832

18611833
/* Here is where we first touch the GSI hardware */
18621834
val = ioread32(gsi->virt + GSI_GSI_STATUS_OFFSET);
@@ -1865,7 +1837,7 @@ int gsi_setup(struct gsi *gsi)
18651837
return -EIO;
18661838
}
18671839

1868-
gsi_irq_setup(gsi);
1840+
gsi_irq_setup(gsi); /* No matching teardown required */
18691841

18701842
val = ioread32(gsi->virt + GSI_GSI_HW_PARAM_2_OFFSET);
18711843

@@ -1899,18 +1871,13 @@ int gsi_setup(struct gsi *gsi)
18991871
/* Writing 1 indicates IRQ interrupts; 0 would be MSI */
19001872
iowrite32(1, gsi->virt + GSI_CNTXT_INTSET_OFFSET);
19011873

1902-
ret = gsi_channel_setup(gsi);
1903-
if (ret)
1904-
gsi_irq_teardown(gsi);
1905-
1906-
return ret;
1874+
return gsi_channel_setup(gsi);
19071875
}
19081876

19091877
/* Inverse of gsi_setup() */
19101878
void gsi_teardown(struct gsi *gsi)
19111879
{
19121880
gsi_channel_teardown(gsi);
1913-
gsi_irq_teardown(gsi);
19141881
}
19151882

19161883
/* Initialize a channel's event ring */
@@ -1952,7 +1919,7 @@ static void gsi_channel_evt_ring_exit(struct gsi_channel *channel)
19521919
gsi_evt_ring_id_free(gsi, evt_ring_id);
19531920
}
19541921

1955-
/* Init function for event rings */
1922+
/* Init function for event rings; there is no gsi_evt_ring_exit() */
19561923
static void gsi_evt_ring_init(struct gsi *gsi)
19571924
{
19581925
u32 evt_ring_id = 0;
@@ -1964,12 +1931,6 @@ static void gsi_evt_ring_init(struct gsi *gsi)
19641931
while (++evt_ring_id < GSI_EVT_RING_COUNT_MAX);
19651932
}
19661933

1967-
/* Inverse of gsi_evt_ring_init() */
1968-
static void gsi_evt_ring_exit(struct gsi *gsi)
1969-
{
1970-
/* Nothing to do */
1971-
}
1972-
19731934
static bool gsi_channel_data_valid(struct gsi *gsi,
19741935
const struct ipa_gsi_endpoint_data *data)
19751936
{
@@ -2114,7 +2075,7 @@ static int gsi_channel_init(struct gsi *gsi, u32 count,
21142075
/* IPA v4.2 requires the AP to allocate channels for the modem */
21152076
modem_alloc = gsi->version == IPA_VERSION_4_2;
21162077

2117-
gsi_evt_ring_init(gsi);
2078+
gsi_evt_ring_init(gsi); /* No matching exit required */
21182079

21192080
/* The endpoint data array is indexed by endpoint name */
21202081
for (i = 0; i < count; i++) {
@@ -2148,7 +2109,6 @@ static int gsi_channel_init(struct gsi *gsi, u32 count,
21482109
}
21492110
gsi_channel_exit_one(&gsi->channel[data->channel_id]);
21502111
}
2151-
gsi_evt_ring_exit(gsi);
21522112

21532113
return ret;
21542114
}
@@ -2162,8 +2122,6 @@ static void gsi_channel_exit(struct gsi *gsi)
21622122
gsi_channel_exit_one(&gsi->channel[channel_id]);
21632123
while (channel_id--);
21642124
gsi->modem_channel_bitmap = 0;
2165-
2166-
gsi_evt_ring_exit(gsi);
21672125
}
21682126

21692127
/* Init function for GSI. GSI hardware does not need to be "ready" */

drivers/net/ipa/gsi_trans.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ int gsi_trans_pool_init(struct gsi_trans_pool *pool, size_t size, u32 count,
9191
void *virt;
9292

9393
#ifdef IPA_VALIDATE
94-
if (!size || size % 8)
94+
if (!size)
9595
return -EINVAL;
9696
if (count < max_alloc)
9797
return -EINVAL;
@@ -141,7 +141,7 @@ int gsi_trans_pool_init_dma(struct device *dev, struct gsi_trans_pool *pool,
141141
void *virt;
142142

143143
#ifdef IPA_VALIDATE
144-
if (!size || size % 8)
144+
if (!size)
145145
return -EINVAL;
146146
if (count < max_alloc)
147147
return -EINVAL;

drivers/net/ipa/ipa_data-v3.5.1.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
116116
.status_enable = true,
117117
.tx = {
118118
.seq_type = IPA_SEQ_2_PASS_SKIP_LAST_UC,
119+
.seq_rep_type = IPA_SEQ_REP_DMA_PARSER,
119120
.status_endpoint =
120121
IPA_ENDPOINT_MODEM_AP_RX,
121122
},

drivers/net/ipa/ipa_endpoint.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ int ipa_endpoint_modem_exception_reset_all(struct ipa *ipa)
397397
/* We need one command per modem TX endpoint. We can get an upper
398398
* bound on that by assuming all initialized endpoints are modem->IPA.
399399
* That won't happen, and we could be more precise, but this is fine
400-
* for now. We need to end the transaction with a "tag process."
400+
* for now. End the transaction with commands to clear the pipeline.
401401
*/
402402
count = hweight32(initialized) + ipa_cmd_pipeline_clear_count();
403403
trans = ipa_cmd_trans_alloc(ipa, count);
@@ -1755,7 +1755,7 @@ int ipa_endpoint_config(struct ipa *ipa)
17551755

17561756
/* Make sure it's pointing in the right direction */
17571757
endpoint = &ipa->endpoint[endpoint_id];
1758-
if ((endpoint_id < rx_base) != !!endpoint->toward_ipa) {
1758+
if ((endpoint_id < rx_base) != endpoint->toward_ipa) {
17591759
dev_err(dev, "endpoint id %u wrong direction\n",
17601760
endpoint_id);
17611761
ret = -EINVAL;
@@ -1791,7 +1791,7 @@ static void ipa_endpoint_init_one(struct ipa *ipa, enum ipa_endpoint_name name,
17911791
ipa->initialized |= BIT(endpoint->endpoint_id);
17921792
}
17931793

1794-
void ipa_endpoint_exit_one(struct ipa_endpoint *endpoint)
1794+
static void ipa_endpoint_exit_one(struct ipa_endpoint *endpoint)
17951795
{
17961796
endpoint->ipa->initialized &= ~BIT(endpoint->endpoint_id);
17971797

drivers/net/ipa/ipa_endpoint.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ int ipa_endpoint_modem_exception_reset_all(struct ipa *ipa);
8787

8888
int ipa_endpoint_skb_tx(struct ipa_endpoint *endpoint, struct sk_buff *skb);
8989

90-
void ipa_endpoint_exit_one(struct ipa_endpoint *endpoint);
91-
9290
int ipa_endpoint_enable_one(struct ipa_endpoint *endpoint);
9391
void ipa_endpoint_disable_one(struct ipa_endpoint *endpoint);
9492

drivers/net/ipa/ipa_main.c

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -147,21 +147,21 @@ int ipa_setup(struct ipa *ipa)
147147
if (ret)
148148
goto err_endpoint_teardown;
149149

150-
ret = ipa_mem_setup(ipa);
150+
ret = ipa_mem_setup(ipa); /* No matching teardown required */
151151
if (ret)
152152
goto err_command_disable;
153153

154-
ret = ipa_table_setup(ipa);
154+
ret = ipa_table_setup(ipa); /* No matching teardown required */
155155
if (ret)
156-
goto err_mem_teardown;
156+
goto err_command_disable;
157157

158158
/* Enable the exception handling endpoint, and tell the hardware
159159
* to use it by default.
160160
*/
161161
exception_endpoint = ipa->name_map[IPA_ENDPOINT_AP_LAN_RX];
162162
ret = ipa_endpoint_enable_one(exception_endpoint);
163163
if (ret)
164-
goto err_table_teardown;
164+
goto err_command_disable;
165165

166166
ipa_endpoint_default_route_set(ipa, exception_endpoint->endpoint_id);
167167

@@ -179,10 +179,6 @@ int ipa_setup(struct ipa *ipa)
179179
err_default_route_clear:
180180
ipa_endpoint_default_route_clear(ipa);
181181
ipa_endpoint_disable_one(exception_endpoint);
182-
err_table_teardown:
183-
ipa_table_teardown(ipa);
184-
err_mem_teardown:
185-
ipa_mem_teardown(ipa);
186182
err_command_disable:
187183
ipa_endpoint_disable_one(command_endpoint);
188184
err_endpoint_teardown:
@@ -211,8 +207,6 @@ static void ipa_teardown(struct ipa *ipa)
211207
ipa_endpoint_default_route_clear(ipa);
212208
exception_endpoint = ipa->name_map[IPA_ENDPOINT_AP_LAN_RX];
213209
ipa_endpoint_disable_one(exception_endpoint);
214-
ipa_table_teardown(ipa);
215-
ipa_mem_teardown(ipa);
216210
command_endpoint = ipa->name_map[IPA_ENDPOINT_AP_COMMAND_TX];
217211
ipa_endpoint_disable_one(command_endpoint);
218212
ipa_endpoint_teardown(ipa);
@@ -480,23 +474,20 @@ static int ipa_config(struct ipa *ipa, const struct ipa_data *data)
480474
if (ret)
481475
goto err_endpoint_deconfig;
482476

483-
ipa_table_config(ipa);
477+
ipa_table_config(ipa); /* No deconfig required */
484478

485-
/* Assign resource limitation to each group */
479+
/* Assign resource limitation to each group; no deconfig required */
486480
ret = ipa_resource_config(ipa, data->resource_data);
487481
if (ret)
488-
goto err_table_deconfig;
482+
goto err_mem_deconfig;
489483

490484
ret = ipa_modem_config(ipa);
491485
if (ret)
492-
goto err_resource_deconfig;
486+
goto err_mem_deconfig;
493487

494488
return 0;
495489

496-
err_resource_deconfig:
497-
ipa_resource_deconfig(ipa);
498-
err_table_deconfig:
499-
ipa_table_deconfig(ipa);
490+
err_mem_deconfig:
500491
ipa_mem_deconfig(ipa);
501492
err_endpoint_deconfig:
502493
ipa_endpoint_deconfig(ipa);
@@ -514,8 +505,6 @@ static int ipa_config(struct ipa *ipa, const struct ipa_data *data)
514505
static void ipa_deconfig(struct ipa *ipa)
515506
{
516507
ipa_modem_deconfig(ipa);
517-
ipa_resource_deconfig(ipa);
518-
ipa_table_deconfig(ipa);
519508
ipa_mem_deconfig(ipa);
520509
ipa_endpoint_deconfig(ipa);
521510
ipa_hardware_deconfig(ipa);

drivers/net/ipa/ipa_mem.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: GPL-2.0
22

33
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
4-
* Copyright (C) 2019-2020 Linaro Ltd.
4+
* Copyright (C) 2019-2021 Linaro Ltd.
55
*/
66

77
#include <linux/types.h>
@@ -53,6 +53,8 @@ ipa_mem_zero_region_add(struct gsi_trans *trans, const struct ipa_mem *mem)
5353
* The AP informs the modem where its portions of memory are located
5454
* in a QMI exchange that occurs at modem startup.
5555
*
56+
* There is no need for a matching ipa_mem_teardown() function.
57+
*
5658
* Return: 0 if successful, or a negative error code
5759
*/
5860
int ipa_mem_setup(struct ipa *ipa)
@@ -97,11 +99,6 @@ int ipa_mem_setup(struct ipa *ipa)
9799
return 0;
98100
}
99101

100-
void ipa_mem_teardown(struct ipa *ipa)
101-
{
102-
/* Nothing to do */
103-
}
104-
105102
#ifdef IPA_VALIDATE
106103

107104
static bool ipa_mem_valid(struct ipa *ipa, enum ipa_mem_id mem_id)

drivers/net/ipa/ipa_mem.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* SPDX-License-Identifier: GPL-2.0 */
22

33
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
4-
* Copyright (C) 2019-2020 Linaro Ltd.
4+
* Copyright (C) 2019-2021 Linaro Ltd.
55
*/
66
#ifndef _IPA_MEM_H_
77
#define _IPA_MEM_H_
@@ -88,8 +88,7 @@ struct ipa_mem {
8888
int ipa_mem_config(struct ipa *ipa);
8989
void ipa_mem_deconfig(struct ipa *ipa);
9090

91-
int ipa_mem_setup(struct ipa *ipa);
92-
void ipa_mem_teardown(struct ipa *ipa);
91+
int ipa_mem_setup(struct ipa *ipa); /* No ipa_mem_teardown() needed */
9392

9493
int ipa_mem_zero_modem(struct ipa *ipa);
9594

0 commit comments

Comments
 (0)