Commit 74858b63 authored by Alex Elder's avatar Alex Elder Committed by Jakub Kicinski

net: ipa: get rid of empty IPA functions

There are place holder functions in the IPA code that do nothing.
For the most part these are inverse functions, for example, once the
routing or filter tables are set up there is no need to perform any
matching teardown activity at shutdown, or in the case of an error.

These can be safely removed, resulting in some code simplification.
Add comments in these spots making it explicit that there is no
inverse.
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 077e770f
...@@ -147,13 +147,13 @@ int ipa_setup(struct ipa *ipa) ...@@ -147,13 +147,13 @@ int ipa_setup(struct ipa *ipa)
if (ret) if (ret)
goto err_endpoint_teardown; goto err_endpoint_teardown;
ret = ipa_mem_setup(ipa); ret = ipa_mem_setup(ipa); /* No matching teardown required */
if (ret) if (ret)
goto err_command_disable; goto err_command_disable;
ret = ipa_table_setup(ipa); ret = ipa_table_setup(ipa); /* No matching teardown required */
if (ret) if (ret)
goto err_mem_teardown; goto err_command_disable;
/* Enable the exception handling endpoint, and tell the hardware /* Enable the exception handling endpoint, and tell the hardware
* to use it by default. * to use it by default.
...@@ -161,7 +161,7 @@ int ipa_setup(struct ipa *ipa) ...@@ -161,7 +161,7 @@ int ipa_setup(struct ipa *ipa)
exception_endpoint = ipa->name_map[IPA_ENDPOINT_AP_LAN_RX]; exception_endpoint = ipa->name_map[IPA_ENDPOINT_AP_LAN_RX];
ret = ipa_endpoint_enable_one(exception_endpoint); ret = ipa_endpoint_enable_one(exception_endpoint);
if (ret) if (ret)
goto err_table_teardown; goto err_command_disable;
ipa_endpoint_default_route_set(ipa, exception_endpoint->endpoint_id); ipa_endpoint_default_route_set(ipa, exception_endpoint->endpoint_id);
...@@ -179,10 +179,6 @@ int ipa_setup(struct ipa *ipa) ...@@ -179,10 +179,6 @@ int ipa_setup(struct ipa *ipa)
err_default_route_clear: err_default_route_clear:
ipa_endpoint_default_route_clear(ipa); ipa_endpoint_default_route_clear(ipa);
ipa_endpoint_disable_one(exception_endpoint); ipa_endpoint_disable_one(exception_endpoint);
err_table_teardown:
ipa_table_teardown(ipa);
err_mem_teardown:
ipa_mem_teardown(ipa);
err_command_disable: err_command_disable:
ipa_endpoint_disable_one(command_endpoint); ipa_endpoint_disable_one(command_endpoint);
err_endpoint_teardown: err_endpoint_teardown:
...@@ -211,8 +207,6 @@ static void ipa_teardown(struct ipa *ipa) ...@@ -211,8 +207,6 @@ static void ipa_teardown(struct ipa *ipa)
ipa_endpoint_default_route_clear(ipa); ipa_endpoint_default_route_clear(ipa);
exception_endpoint = ipa->name_map[IPA_ENDPOINT_AP_LAN_RX]; exception_endpoint = ipa->name_map[IPA_ENDPOINT_AP_LAN_RX];
ipa_endpoint_disable_one(exception_endpoint); ipa_endpoint_disable_one(exception_endpoint);
ipa_table_teardown(ipa);
ipa_mem_teardown(ipa);
command_endpoint = ipa->name_map[IPA_ENDPOINT_AP_COMMAND_TX]; command_endpoint = ipa->name_map[IPA_ENDPOINT_AP_COMMAND_TX];
ipa_endpoint_disable_one(command_endpoint); ipa_endpoint_disable_one(command_endpoint);
ipa_endpoint_teardown(ipa); ipa_endpoint_teardown(ipa);
...@@ -480,23 +474,20 @@ static int ipa_config(struct ipa *ipa, const struct ipa_data *data) ...@@ -480,23 +474,20 @@ static int ipa_config(struct ipa *ipa, const struct ipa_data *data)
if (ret) if (ret)
goto err_endpoint_deconfig; goto err_endpoint_deconfig;
ipa_table_config(ipa); ipa_table_config(ipa); /* No deconfig required */
/* Assign resource limitation to each group */ /* Assign resource limitation to each group; no deconfig required */
ret = ipa_resource_config(ipa, data->resource_data); ret = ipa_resource_config(ipa, data->resource_data);
if (ret) if (ret)
goto err_table_deconfig; goto err_mem_deconfig;
ret = ipa_modem_config(ipa); ret = ipa_modem_config(ipa);
if (ret) if (ret)
goto err_resource_deconfig; goto err_mem_deconfig;
return 0; return 0;
err_resource_deconfig: err_mem_deconfig:
ipa_resource_deconfig(ipa);
err_table_deconfig:
ipa_table_deconfig(ipa);
ipa_mem_deconfig(ipa); ipa_mem_deconfig(ipa);
err_endpoint_deconfig: err_endpoint_deconfig:
ipa_endpoint_deconfig(ipa); ipa_endpoint_deconfig(ipa);
...@@ -514,8 +505,6 @@ static int ipa_config(struct ipa *ipa, const struct ipa_data *data) ...@@ -514,8 +505,6 @@ static int ipa_config(struct ipa *ipa, const struct ipa_data *data)
static void ipa_deconfig(struct ipa *ipa) static void ipa_deconfig(struct ipa *ipa)
{ {
ipa_modem_deconfig(ipa); ipa_modem_deconfig(ipa);
ipa_resource_deconfig(ipa);
ipa_table_deconfig(ipa);
ipa_mem_deconfig(ipa); ipa_mem_deconfig(ipa);
ipa_endpoint_deconfig(ipa); ipa_endpoint_deconfig(ipa);
ipa_hardware_deconfig(ipa); ipa_hardware_deconfig(ipa);
......
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
* Copyright (C) 2019-2020 Linaro Ltd. * Copyright (C) 2019-2021 Linaro Ltd.
*/ */
#include <linux/types.h> #include <linux/types.h>
...@@ -53,6 +53,8 @@ ipa_mem_zero_region_add(struct gsi_trans *trans, const struct ipa_mem *mem) ...@@ -53,6 +53,8 @@ ipa_mem_zero_region_add(struct gsi_trans *trans, const struct ipa_mem *mem)
* The AP informs the modem where its portions of memory are located * The AP informs the modem where its portions of memory are located
* in a QMI exchange that occurs at modem startup. * in a QMI exchange that occurs at modem startup.
* *
* There is no need for a matching ipa_mem_teardown() function.
*
* Return: 0 if successful, or a negative error code * Return: 0 if successful, or a negative error code
*/ */
int ipa_mem_setup(struct ipa *ipa) int ipa_mem_setup(struct ipa *ipa)
...@@ -97,11 +99,6 @@ int ipa_mem_setup(struct ipa *ipa) ...@@ -97,11 +99,6 @@ int ipa_mem_setup(struct ipa *ipa)
return 0; return 0;
} }
void ipa_mem_teardown(struct ipa *ipa)
{
/* Nothing to do */
}
#ifdef IPA_VALIDATE #ifdef IPA_VALIDATE
static bool ipa_mem_valid(struct ipa *ipa, enum ipa_mem_id mem_id) static bool ipa_mem_valid(struct ipa *ipa, enum ipa_mem_id mem_id)
......
/* SPDX-License-Identifier: GPL-2.0 */ /* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
* Copyright (C) 2019-2020 Linaro Ltd. * Copyright (C) 2019-2021 Linaro Ltd.
*/ */
#ifndef _IPA_MEM_H_ #ifndef _IPA_MEM_H_
#define _IPA_MEM_H_ #define _IPA_MEM_H_
...@@ -88,8 +88,7 @@ struct ipa_mem { ...@@ -88,8 +88,7 @@ struct ipa_mem {
int ipa_mem_config(struct ipa *ipa); int ipa_mem_config(struct ipa *ipa);
void ipa_mem_deconfig(struct ipa *ipa); void ipa_mem_deconfig(struct ipa *ipa);
int ipa_mem_setup(struct ipa *ipa); int ipa_mem_setup(struct ipa *ipa); /* No ipa_mem_teardown() needed */
void ipa_mem_teardown(struct ipa *ipa);
int ipa_mem_zero_modem(struct ipa *ipa); int ipa_mem_zero_modem(struct ipa *ipa);
......
...@@ -158,7 +158,7 @@ static void ipa_resource_config_dst(struct ipa *ipa, u32 resource_type, ...@@ -158,7 +158,7 @@ static void ipa_resource_config_dst(struct ipa *ipa, u32 resource_type,
ipa_resource_config_common(ipa, offset, &resource->limits[6], ylimits); ipa_resource_config_common(ipa, offset, &resource->limits[6], ylimits);
} }
/* Configure resources */ /* Configure resources; there is no ipa_resource_deconfig() */
int ipa_resource_config(struct ipa *ipa, const struct ipa_resource_data *data) int ipa_resource_config(struct ipa *ipa, const struct ipa_resource_data *data)
{ {
u32 i; u32 i;
...@@ -174,9 +174,3 @@ int ipa_resource_config(struct ipa *ipa, const struct ipa_resource_data *data) ...@@ -174,9 +174,3 @@ int ipa_resource_config(struct ipa *ipa, const struct ipa_resource_data *data)
return 0; return 0;
} }
/* Inverse of ipa_resource_config() */
void ipa_resource_deconfig(struct ipa *ipa)
{
/* Nothing to do */
}
...@@ -14,14 +14,10 @@ struct ipa_resource_data; ...@@ -14,14 +14,10 @@ struct ipa_resource_data;
* @ipa: IPA pointer * @ipa: IPA pointer
* @data: IPA resource configuration data * @data: IPA resource configuration data
* *
* There is no need for a matching ipa_resource_deconfig() function.
*
* Return: true if all regions are valid, false otherwise * Return: true if all regions are valid, false otherwise
*/ */
int ipa_resource_config(struct ipa *ipa, const struct ipa_resource_data *data); int ipa_resource_config(struct ipa *ipa, const struct ipa_resource_data *data);
/**
* ipa_resource_deconfig() - Inverse of ipa_resource_config()
* @ipa: IPA pointer
*/
void ipa_resource_deconfig(struct ipa *ipa);
#endif /* _IPA_RESOURCE_H_ */ #endif /* _IPA_RESOURCE_H_ */
...@@ -497,11 +497,6 @@ int ipa_table_setup(struct ipa *ipa) ...@@ -497,11 +497,6 @@ int ipa_table_setup(struct ipa *ipa)
return 0; return 0;
} }
void ipa_table_teardown(struct ipa *ipa)
{
/* Nothing to do */ /* XXX Maybe reset the tables? */
}
/** /**
* ipa_filter_tuple_zero() - Zero an endpoint's hashed filter tuple * ipa_filter_tuple_zero() - Zero an endpoint's hashed filter tuple
* @endpoint: Endpoint whose filter hash tuple should be zeroed * @endpoint: Endpoint whose filter hash tuple should be zeroed
...@@ -525,6 +520,7 @@ static void ipa_filter_tuple_zero(struct ipa_endpoint *endpoint) ...@@ -525,6 +520,7 @@ static void ipa_filter_tuple_zero(struct ipa_endpoint *endpoint)
iowrite32(val, endpoint->ipa->reg_virt + offset); iowrite32(val, endpoint->ipa->reg_virt + offset);
} }
/* Configure a hashed filter table; there is no ipa_filter_deconfig() */
static void ipa_filter_config(struct ipa *ipa, bool modem) static void ipa_filter_config(struct ipa *ipa, bool modem)
{ {
enum gsi_ee_id ee_id = modem ? GSI_EE_MODEM : GSI_EE_AP; enum gsi_ee_id ee_id = modem ? GSI_EE_MODEM : GSI_EE_AP;
...@@ -545,11 +541,6 @@ static void ipa_filter_config(struct ipa *ipa, bool modem) ...@@ -545,11 +541,6 @@ static void ipa_filter_config(struct ipa *ipa, bool modem)
} }
} }
static void ipa_filter_deconfig(struct ipa *ipa, bool modem)
{
/* Nothing to do */
}
static bool ipa_route_id_modem(u32 route_id) static bool ipa_route_id_modem(u32 route_id)
{ {
return route_id >= IPA_ROUTE_MODEM_MIN && return route_id >= IPA_ROUTE_MODEM_MIN &&
...@@ -576,6 +567,7 @@ static void ipa_route_tuple_zero(struct ipa *ipa, u32 route_id) ...@@ -576,6 +567,7 @@ static void ipa_route_tuple_zero(struct ipa *ipa, u32 route_id)
iowrite32(val, ipa->reg_virt + offset); iowrite32(val, ipa->reg_virt + offset);
} }
/* Configure a hashed route table; there is no ipa_route_deconfig() */
static void ipa_route_config(struct ipa *ipa, bool modem) static void ipa_route_config(struct ipa *ipa, bool modem)
{ {
u32 route_id; u32 route_id;
...@@ -588,11 +580,7 @@ static void ipa_route_config(struct ipa *ipa, bool modem) ...@@ -588,11 +580,7 @@ static void ipa_route_config(struct ipa *ipa, bool modem)
ipa_route_tuple_zero(ipa, route_id); ipa_route_tuple_zero(ipa, route_id);
} }
static void ipa_route_deconfig(struct ipa *ipa, bool modem) /* Configure a filter and route tables; there is no ipa_table_deconfig() */
{
/* Nothing to do */
}
void ipa_table_config(struct ipa *ipa) void ipa_table_config(struct ipa *ipa)
{ {
ipa_filter_config(ipa, false); ipa_filter_config(ipa, false);
...@@ -601,14 +589,6 @@ void ipa_table_config(struct ipa *ipa) ...@@ -601,14 +589,6 @@ void ipa_table_config(struct ipa *ipa)
ipa_route_config(ipa, true); ipa_route_config(ipa, true);
} }
void ipa_table_deconfig(struct ipa *ipa)
{
ipa_route_deconfig(ipa, true);
ipa_route_deconfig(ipa, false);
ipa_filter_deconfig(ipa, true);
ipa_filter_deconfig(ipa, false);
}
/* /*
* Initialize a coherent DMA allocation containing initialized filter and * Initialize a coherent DMA allocation containing initialized filter and
* route table data. This is used when initializing or resetting the IPA * route table data. This is used when initializing or resetting the IPA
......
...@@ -74,27 +74,19 @@ int ipa_table_hash_flush(struct ipa *ipa); ...@@ -74,27 +74,19 @@ int ipa_table_hash_flush(struct ipa *ipa);
/** /**
* ipa_table_setup() - Set up filter and route tables * ipa_table_setup() - Set up filter and route tables
* @ipa: IPA pointer * @ipa: IPA pointer
*
* There is no need for a matching ipa_table_teardown() function.
*/ */
int ipa_table_setup(struct ipa *ipa); int ipa_table_setup(struct ipa *ipa);
/**
* ipa_table_teardown() - Inverse of ipa_table_setup()
* @ipa: IPA pointer
*/
void ipa_table_teardown(struct ipa *ipa);
/** /**
* ipa_table_config() - Configure filter and route tables * ipa_table_config() - Configure filter and route tables
* @ipa: IPA pointer * @ipa: IPA pointer
*
* There is no need for a matching ipa_table_deconfig() function.
*/ */
void ipa_table_config(struct ipa *ipa); void ipa_table_config(struct ipa *ipa);
/**
* ipa_table_deconfig() - Inverse of ipa_table_config()
* @ipa: IPA pointer
*/
void ipa_table_deconfig(struct ipa *ipa);
/** /**
* ipa_table_init() - Do early initialization of filter and route tables * ipa_table_init() - Do early initialization of filter and route tables
* @ipa: IPA pointer * @ipa: IPA pointer
......
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