* [dpdk-dev] [PATCH 0/2] functions with useless return
@ 2015-04-17 15:35 Stephen Hemminger
2015-04-17 15:35 ` [dpdk-dev] [PATCH 1/2] log: rte_openlog_stream should be void Stephen Hemminger
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Stephen Hemminger @ 2015-04-17 15:35 UTC (permalink / raw)
To: dev
Fix a couple of cases (there are more) where functions
always return 0, by changing them to be void.
Stephen Hemminger (2):
log: rte_openlog_stream should be void
eal: pci probe and adjust_config should be void
lib/librte_eal/common/eal_common_log.c | 3 +--
lib/librte_eal/common/eal_common_options.c | 3 +--
lib/librte_eal/common/eal_common_pci.c | 7 ++-----
lib/librte_eal/common/eal_options.h | 2 +-
lib/librte_eal/common/include/rte_log.h | 5 +----
lib/librte_eal/common/include/rte_pci.h | 6 +-----
lib/librte_eal/linuxapp/eal/eal.c | 6 ++----
7 files changed, 9 insertions(+), 23 deletions(-)
--
2.1.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH 1/2] log: rte_openlog_stream should be void
2015-04-17 15:35 [dpdk-dev] [PATCH 0/2] functions with useless return Stephen Hemminger
@ 2015-04-17 15:35 ` Stephen Hemminger
2015-05-19 10:24 ` Bruce Richardson
2015-04-17 15:35 ` [dpdk-dev] [PATCH 2/2] eal: pci probe and adjust_config " Stephen Hemminger
2015-04-17 15:53 ` [dpdk-dev] [PATCH 0/2] functions with useless return Neil Horman
2 siblings, 1 reply; 7+ messages in thread
From: Stephen Hemminger @ 2015-04-17 15:35 UTC (permalink / raw)
To: dev
Function always returned 0 and no one was checking anyway.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/librte_eal/common/eal_common_log.c | 3 +--
lib/librte_eal/common/include/rte_log.h | 5 +----
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c
index ff44d23..3802f9c 100644
--- a/lib/librte_eal/common/eal_common_log.c
+++ b/lib/librte_eal/common/eal_common_log.c
@@ -158,14 +158,13 @@ rte_log_set_history(int enable)
}
/* Change the stream that will be used by logging system */
-int
+void
rte_openlog_stream(FILE *f)
{
if (f == NULL)
rte_logs.file = default_log_stream;
else
rte_logs.file = f;
- return 0;
}
/* Set global log level */
diff --git a/lib/librte_eal/common/include/rte_log.h b/lib/librte_eal/common/include/rte_log.h
index f83a0d9..888ee19 100644
--- a/lib/librte_eal/common/include/rte_log.h
+++ b/lib/librte_eal/common/include/rte_log.h
@@ -110,11 +110,8 @@ extern FILE *eal_default_log_stream;
*
* @param f
* Pointer to the stream.
- * @return
- * - 0 on success.
- * - Negative on error.
*/
-int rte_openlog_stream(FILE *f);
+void rte_openlog_stream(FILE *f);
/**
* Set the global log level.
--
2.1.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH 2/2] eal: pci probe and adjust_config should be void
2015-04-17 15:35 [dpdk-dev] [PATCH 0/2] functions with useless return Stephen Hemminger
2015-04-17 15:35 ` [dpdk-dev] [PATCH 1/2] log: rte_openlog_stream should be void Stephen Hemminger
@ 2015-04-17 15:35 ` Stephen Hemminger
2015-04-20 13:14 ` Thomas Monjalon
2015-04-17 15:53 ` [dpdk-dev] [PATCH 0/2] functions with useless return Neil Horman
2 siblings, 1 reply; 7+ messages in thread
From: Stephen Hemminger @ 2015-04-17 15:35 UTC (permalink / raw)
To: dev
This functions always returned 0 and therefore should be void.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/librte_eal/common/eal_common_options.c | 3 +--
lib/librte_eal/common/eal_common_pci.c | 7 ++-----
lib/librte_eal/common/eal_options.h | 2 +-
lib/librte_eal/common/include/rte_pci.h | 6 +-----
lib/librte_eal/linuxapp/eal/eal.c | 6 ++----
5 files changed, 7 insertions(+), 17 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 8fcb1ab..f47b401 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -794,7 +794,7 @@ eal_parse_common_option(int opt, const char *optarg,
return 0;
}
-int
+void
eal_adjust_config(struct internal_config *internal_cfg)
{
int i;
@@ -812,7 +812,6 @@ eal_adjust_config(struct internal_config *internal_cfg)
for (i = 0; i < RTE_MAX_NUMA_NODES; i++)
internal_cfg->memory += internal_cfg->socket_mem[i];
- return 0;
}
int
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 808b87b..93c8e84 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -223,7 +223,7 @@ err_return:
* all registered drivers that have a matching entry in its id_table
* for discovered devices.
*/
-int
+void
rte_eal_pci_probe(void)
{
struct rte_pci_device *dev = NULL;
@@ -252,12 +252,10 @@ rte_eal_pci_probe(void)
" cannot be used\n", dev->addr.domain, dev->addr.bus,
dev->addr.devid, dev->addr.function);
}
-
- return 0;
}
/* dump one device */
-static int
+static void
pci_dump_one_device(FILE *f, struct rte_pci_device *dev)
{
int i;
@@ -273,7 +271,6 @@ pci_dump_one_device(FILE *f, struct rte_pci_device *dev)
dev->mem_resource[i].phys_addr,
dev->mem_resource[i].len);
}
- return 0;
}
/* dump devices on the bus */
diff --git a/lib/librte_eal/common/eal_options.h b/lib/librte_eal/common/eal_options.h
index f6714d9..59a0f39 100644
--- a/lib/librte_eal/common/eal_options.h
+++ b/lib/librte_eal/common/eal_options.h
@@ -89,7 +89,7 @@ extern const struct option eal_long_options[];
int eal_parse_common_option(int opt, const char *argv,
struct internal_config *conf);
-int eal_adjust_config(struct internal_config *internal_cfg);
+void eal_adjust_config(struct internal_config *internal_cfg);
int eal_check_common_options(struct internal_config *internal_cfg);
void eal_common_usage(void);
enum rte_proc_type_t eal_proc_type_detect(void);
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 785852d..052d3da 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -327,12 +327,8 @@ int rte_eal_pci_scan(void);
* Scan the content of the PCI bus, and call the probe() function for
* all registered drivers that have a matching entry in its id_table
* for discovered devices.
- *
- * @return
- * - 0 on success.
- * - Negative on error.
*/
-int rte_eal_pci_probe(void);
+void rte_eal_pci_probe(void);
#ifdef RTE_LIBRTE_EAL_HOTPLUG
/**
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index bd770cf..e2a5468 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -621,8 +621,7 @@ eal_parse_args(int argc, char **argv)
}
}
- if (eal_adjust_config(&internal_config) != 0)
- return -1;
+ eal_adjust_config(&internal_config);
/* sanity checks */
if (eal_check_common_options(&internal_config) != 0) {
@@ -842,8 +841,7 @@ rte_eal_init(int argc, char **argv)
rte_eal_mp_wait_lcore();
/* Probe & Initialize PCI devices */
- if (rte_eal_pci_probe())
- rte_panic("Cannot probe PCI\n");
+ rte_eal_pci_probe();
return fctret;
}
--
2.1.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH 0/2] functions with useless return
2015-04-17 15:35 [dpdk-dev] [PATCH 0/2] functions with useless return Stephen Hemminger
2015-04-17 15:35 ` [dpdk-dev] [PATCH 1/2] log: rte_openlog_stream should be void Stephen Hemminger
2015-04-17 15:35 ` [dpdk-dev] [PATCH 2/2] eal: pci probe and adjust_config " Stephen Hemminger
@ 2015-04-17 15:53 ` Neil Horman
2 siblings, 0 replies; 7+ messages in thread
From: Neil Horman @ 2015-04-17 15:53 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev
On Fri, Apr 17, 2015 at 08:35:32AM -0700, Stephen Hemminger wrote:
> Fix a couple of cases (there are more) where functions
> always return 0, by changing them to be void.
>
> Stephen Hemminger (2):
> log: rte_openlog_stream should be void
> eal: pci probe and adjust_config should be void
>
> lib/librte_eal/common/eal_common_log.c | 3 +--
> lib/librte_eal/common/eal_common_options.c | 3 +--
> lib/librte_eal/common/eal_common_pci.c | 7 ++-----
> lib/librte_eal/common/eal_options.h | 2 +-
> lib/librte_eal/common/include/rte_log.h | 5 +----
> lib/librte_eal/common/include/rte_pci.h | 6 +-----
> lib/librte_eal/linuxapp/eal/eal.c | 6 ++----
> 7 files changed, 9 insertions(+), 23 deletions(-)
>
> --
> 2.1.4
>
>
Series
Acked-by: Neil Horman <nhorman@tuxdriver.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH 2/2] eal: pci probe and adjust_config should be void
2015-04-17 15:35 ` [dpdk-dev] [PATCH 2/2] eal: pci probe and adjust_config " Stephen Hemminger
@ 2015-04-20 13:14 ` Thomas Monjalon
0 siblings, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2015-04-20 13:14 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev
2015-04-17 08:35, Stephen Hemminger:
> This functions always returned 0 and therefore should be void.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> lib/librte_eal/common/eal_common_options.c | 3 +--
> lib/librte_eal/common/eal_common_pci.c | 7 ++-----
> lib/librte_eal/common/eal_options.h | 2 +-
> lib/librte_eal/common/include/rte_pci.h | 6 +-----
> lib/librte_eal/linuxapp/eal/eal.c | 6 ++----
> 5 files changed, 7 insertions(+), 17 deletions(-)
Why bsdapp is not changed?
You posted a similar patch few days before which was modifying bsdapp:
http://dpdk.org/dev/patchwork/patch/4306/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH 1/2] log: rte_openlog_stream should be void
2015-04-17 15:35 ` [dpdk-dev] [PATCH 1/2] log: rte_openlog_stream should be void Stephen Hemminger
@ 2015-05-19 10:24 ` Bruce Richardson
2015-07-30 0:35 ` Stephen Hemminger
0 siblings, 1 reply; 7+ messages in thread
From: Bruce Richardson @ 2015-05-19 10:24 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev
On Fri, Apr 17, 2015 at 08:35:33AM -0700, Stephen Hemminger wrote:
> Function always returned 0 and no one was checking anyway.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
> lib/librte_eal/common/eal_common_log.c | 3 +--
> lib/librte_eal/common/include/rte_log.h | 5 +----
> 2 files changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c
> index ff44d23..3802f9c 100644
> --- a/lib/librte_eal/common/eal_common_log.c
> +++ b/lib/librte_eal/common/eal_common_log.c
> @@ -158,14 +158,13 @@ rte_log_set_history(int enable)
> }
>
> /* Change the stream that will be used by logging system */
> -int
> +void
> rte_openlog_stream(FILE *f)
> {
> if (f == NULL)
> rte_logs.file = default_log_stream;
> else
> rte_logs.file = f;
> - return 0;
> }
>
> /* Set global log level */
> diff --git a/lib/librte_eal/common/include/rte_log.h b/lib/librte_eal/common/include/rte_log.h
> index f83a0d9..888ee19 100644
> --- a/lib/librte_eal/common/include/rte_log.h
> +++ b/lib/librte_eal/common/include/rte_log.h
> @@ -110,11 +110,8 @@ extern FILE *eal_default_log_stream;
> *
> * @param f
> * Pointer to the stream.
> - * @return
> - * - 0 on success.
> - * - Negative on error.
> */
> -int rte_openlog_stream(FILE *f);
> +void rte_openlog_stream(FILE *f);
>
> /**
> * Set the global log level.
> --
> 2.1.4
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH 1/2] log: rte_openlog_stream should be void
2015-05-19 10:24 ` Bruce Richardson
@ 2015-07-30 0:35 ` Stephen Hemminger
0 siblings, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2015-07-30 0:35 UTC (permalink / raw)
To: Bruce Richardson; +Cc: dev
On Tue, 19 May 2015 11:24:03 +0100
Bruce Richardson <bruce.richardson@intel.com> wrote:
> On Fri, Apr 17, 2015 at 08:35:33AM -0700, Stephen Hemminger wrote:
> > Function always returned 0 and no one was checking anyway.
> >
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
>
> > ---
> > lib/librte_eal/common/eal_common_log.c | 3 +--
> > lib/librte_eal/common/include/rte_log.h | 5 +----
> > 2 files changed, 2 insertions(+), 6 deletions(-)
> >
> > diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c
> > index ff44d23..3802f9c 100644
> > --- a/lib/librte_eal/common/eal_common_log.c
> > +++ b/lib/librte_eal/common/eal_common_log.c
> > @@ -158,14 +158,13 @@ rte_log_set_history(int enable)
> > }
> >
> > /* Change the stream that will be used by logging system */
> > -int
> > +void
> > rte_openlog_stream(FILE *f)
> > {
> > if (f == NULL)
> > rte_logs.file = default_log_stream;
> > else
> > rte_logs.file = f;
> > - return 0;
> > }
> >
> > /* Set global log level */
> > diff --git a/lib/librte_eal/common/include/rte_log.h b/lib/librte_eal/common/include/rte_log.h
> > index f83a0d9..888ee19 100644
> > --- a/lib/librte_eal/common/include/rte_log.h
> > +++ b/lib/librte_eal/common/include/rte_log.h
> > @@ -110,11 +110,8 @@ extern FILE *eal_default_log_stream;
> > *
> > * @param f
> > * Pointer to the stream.
> > - * @return
> > - * - 0 on success.
> > - * - Negative on error.
> > */
> > -int rte_openlog_stream(FILE *f);
> > +void rte_openlog_stream(FILE *f);
> >
> > /**
> > * Set the global log level.
> > --
> > 2.1.4
> >
Yes it should be void, but technically this is an ABI change.
Please drop the patch.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-07-30 0:35 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-17 15:35 [dpdk-dev] [PATCH 0/2] functions with useless return Stephen Hemminger
2015-04-17 15:35 ` [dpdk-dev] [PATCH 1/2] log: rte_openlog_stream should be void Stephen Hemminger
2015-05-19 10:24 ` Bruce Richardson
2015-07-30 0:35 ` Stephen Hemminger
2015-04-17 15:35 ` [dpdk-dev] [PATCH 2/2] eal: pci probe and adjust_config " Stephen Hemminger
2015-04-20 13:14 ` Thomas Monjalon
2015-04-17 15:53 ` [dpdk-dev] [PATCH 0/2] functions with useless return Neil Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).