public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] kexec-tools: remove unused code from arch_process_options (arm, cris, ia64, mips, ppc)
@ 2010-05-13  7:33 Matt Evans
  2010-05-13  7:50 ` Matt Evans
  0 siblings, 1 reply; 3+ messages in thread
From: Matt Evans @ 2010-05-13  7:33 UTC (permalink / raw)
  To: kexec; +Cc: horms


These architectures don't have any architecture-specific options
(note: distinct from loader options, which are more specific), yet
their arch_process_options() functions contain getopts_long() calls
followed by no argument processing.  The code doesn't do anything,
so this patch removes it.

Signed-off-by: Matt Evans <matt@ozlabs.org>
---
 kexec/arch/arm/kexec-arm.c   |   17 -----------------
 kexec/arch/cris/kexec-cris.c |   17 -----------------
 kexec/arch/ia64/kexec-ia64.c |   21 +++------------------
 kexec/arch/mips/kexec-mips.c |   17 -----------------
 kexec/arch/ppc/kexec-ppc.c   |   17 -----------------
 5 files changed, 3 insertions(+), 86 deletions(-)

diff --git a/kexec/arch/arm/kexec-arm.c b/kexec/arch/arm/kexec-arm.c
index 06ed8fd..de3f713 100644
--- a/kexec/arch/arm/kexec-arm.c
+++ b/kexec/arch/arm/kexec-arm.c
@@ -88,23 +88,6 @@ void arch_usage(void)
 
 int arch_process_options(int argc, char **argv)
 {
-	static const struct option options[] = {
-		KEXEC_ARCH_OPTIONS
-		{ 0,			0, NULL, 0 },
-	};
-	static const char short_options[] = KEXEC_ARCH_OPT_STR;
-	int opt;
-
-	opterr = 0; /* Don't complain about unrecognized options here */
-	while((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) {
-		switch(opt) {
-		default:
-			break;
-		}
-	}
-	/* Reset getopt for the next pass; called in other source modules */
-	opterr = 1;
-	optind = 1;
 	return 0;
 }
 
diff --git a/kexec/arch/cris/kexec-cris.c b/kexec/arch/cris/kexec-cris.c
index 30df27e..38876f6 100644
--- a/kexec/arch/cris/kexec-cris.c
+++ b/kexec/arch/cris/kexec-cris.c
@@ -54,23 +54,6 @@ void arch_usage(void)
 
 int arch_process_options(int argc, char **argv)
 {
-	static const struct option options[] = {
-		KEXEC_ARCH_OPTIONS
-		{ 0,                    0, NULL, 0 },
-	};
-	static const char short_options[] = KEXEC_ARCH_OPT_STR;
-	int opt;
-
-	opterr = 0; /* Don't complain about unrecognized options here */
-	while((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) {
-		switch(opt) {
-		default:
-			break;
-		}
-	}
-	/* Reset getopt for the next pass; called in other source modules */
-	opterr = 1;
-	optind = 1;
 	return 0;
 }
 
diff --git a/kexec/arch/ia64/kexec-ia64.c b/kexec/arch/ia64/kexec-ia64.c
index edd3674..aa510a9 100644
--- a/kexec/arch/ia64/kexec-ia64.c
+++ b/kexec/arch/ia64/kexec-ia64.c
@@ -180,29 +180,14 @@ void arch_usage(void)
 
 int arch_process_options(int argc, char **argv)
 {
-	static const struct option options[] = {
-		KEXEC_ARCH_OPTIONS
-		{ 0, 0, NULL, 0 },
-	};
-	static const char short_options[] = KEXEC_ARCH_OPT_STR;
-	int opt;
+	/* This doesn't belong here!  Some sort of arch_init() ? */
 
 	/* execute from monarch processor */
-        cpu_set_t affinity;
+	cpu_set_t affinity;
 	CPU_ZERO(&affinity);
 	CPU_SET(0, &affinity);
-        sched_setaffinity(0, sizeof(affinity), &affinity);
+	sched_setaffinity(0, sizeof(affinity), &affinity);
 
-	opterr = 0; /* Don't complain about unrecognized options here */
-	while((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) {
-		switch(opt) {
-		default:
-			break;
-		}
-	}
-	/* Reset getopt for the next pass; called in other source modules */
-	opterr = 1;
-	optind = 1;
 	return 0;
 }
 
diff --git a/kexec/arch/mips/kexec-mips.c b/kexec/arch/mips/kexec-mips.c
index bd12bb3..fe0c945 100644
--- a/kexec/arch/mips/kexec-mips.c
+++ b/kexec/arch/mips/kexec-mips.c
@@ -88,23 +88,6 @@ struct arch_options_t arch_options = {
 
 int arch_process_options(int argc, char **argv)
 {
-	static const struct option options[] = {
-		KEXEC_ARCH_OPTIONS
-		{ 0,                    0, NULL, 0 },
-	};
-	static const char short_options[] = KEXEC_ARCH_OPT_STR;
-	int opt;
-
-	opterr = 0; /* Don't complain about unrecognized options here */
-	while((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) {
-		switch(opt) {
-		default:
-			break;
-		}
-	}
-	/* Reset getopt for the next pass; called in other source modules */
-	opterr = 1;
-	optind = 1;
 	return 0;
 }
 
diff --git a/kexec/arch/ppc/kexec-ppc.c b/kexec/arch/ppc/kexec-ppc.c
index f552d79..effe94c 100644
--- a/kexec/arch/ppc/kexec-ppc.c
+++ b/kexec/arch/ppc/kexec-ppc.c
@@ -495,23 +495,6 @@ void arch_usage(void)
 
 int arch_process_options(int argc, char **argv)
 {
-	static const struct option options[] = {
-		KEXEC_ARCH_OPTIONS
-		{ 0, 			0, NULL, 0 },
-	};
-	static const char short_options[] = KEXEC_ARCH_OPT_STR;
-	int opt;
-
-	opterr = 0; /* Don't complain about unrecognized options here */
-	while((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) {
-		switch(opt) {
-		default:
-			break;
-		}
-	}
-	/* Reset getopt for the next pass; called in other source modules */
-	opterr = 1;
-	optind = 1;
 	return 0;
 }
 
-- 
1.6.3.3


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kexec-tools: remove unused code from arch_process_options (arm, cris, ia64, mips, ppc)
  2010-05-13  7:33 [PATCH] kexec-tools: remove unused code from arch_process_options (arm, cris, ia64, mips, ppc) Matt Evans
@ 2010-05-13  7:50 ` Matt Evans
  2010-05-13 14:29   ` Simon Horman
  0 siblings, 1 reply; 3+ messages in thread
From: Matt Evans @ 2010-05-13  7:50 UTC (permalink / raw)
  To: kexec; +Cc: horms

Matt Evans wrote:
> These architectures don't have any architecture-specific options
> (note: distinct from loader options, which are more specific), yet
> their arch_process_options() functions contain getopts_long() calls
> followed by no argument processing.  The code doesn't do anything,
> so this patch removes it.
> 
> Signed-off-by: Matt Evans <matt@ozlabs.org>
> ---
>  kexec/arch/arm/kexec-arm.c   |   17 -----------------
>  kexec/arch/cris/kexec-cris.c |   17 -----------------
>  kexec/arch/ia64/kexec-ia64.c |   21 +++------------------
>  kexec/arch/mips/kexec-mips.c |   17 -----------------
>  kexec/arch/ppc/kexec-ppc.c   |   17 -----------------
>  5 files changed, 3 insertions(+), 86 deletions(-)

I forgot to add that unfortunately I have only been able to compile this patch on ppc.  Since the code carefully removed doesn't have any effect I am hopeful for the rest...  :-)


Cheers,


Matt


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kexec-tools: remove unused code from arch_process_options (arm, cris, ia64, mips, ppc)
  2010-05-13  7:50 ` Matt Evans
@ 2010-05-13 14:29   ` Simon Horman
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Horman @ 2010-05-13 14:29 UTC (permalink / raw)
  To: Matt Evans; +Cc: kexec

On Thu, May 13, 2010 at 05:50:56PM +1000, Matt Evans wrote:
> Matt Evans wrote:
> > These architectures don't have any architecture-specific options
> > (note: distinct from loader options, which are more specific), yet
> > their arch_process_options() functions contain getopts_long() calls
> > followed by no argument processing.  The code doesn't do anything,
> > so this patch removes it.
> > 
> > Signed-off-by: Matt Evans <matt@ozlabs.org>
> > ---
> >  kexec/arch/arm/kexec-arm.c   |   17 -----------------
> >  kexec/arch/cris/kexec-cris.c |   17 -----------------
> >  kexec/arch/ia64/kexec-ia64.c |   21 +++------------------
> >  kexec/arch/mips/kexec-mips.c |   17 -----------------
> >  kexec/arch/ppc/kexec-ppc.c   |   17 -----------------
> >  5 files changed, 3 insertions(+), 86 deletions(-)
> 
> I forgot to add that unfortunately I have only been able to compile this
> patch on ppc.  Since the code carefully removed doesn't have any effect I
> am hopeful for the rest...  :-)

Thanks, applied.

I successfully compiled the code for the other architectures
with the exception of cris (as I don't have access to the box
with that cross compiler at the moment).

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-05-13 14:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-13  7:33 [PATCH] kexec-tools: remove unused code from arch_process_options (arm, cris, ia64, mips, ppc) Matt Evans
2010-05-13  7:50 ` Matt Evans
2010-05-13 14:29   ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox