mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: minyard@acm.org
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
	OpenIPMI Developers <openipmi-developer@lists.sourceforge.net>
Subject: Re: [PATCH 8/12] IPMI: system interface hotplug
Date: Sun, 3 Dec 2006 13:26:15 -0800	[thread overview]
Message-ID: <20061203132615.3cda55c7.akpm@osdl.org> (raw)
In-Reply-To: <20061202043655.GD30531@localdomain>

On Fri, 1 Dec 2006 22:36:55 -0600
Corey Minyard <minyard@acm.org> wrote:

> 
> Add the ability to hot add and remove interfaces in the ipmi_si
> driver.  Any users who have the device open will get errors if they
> try to send a message.
> 
> ...
>
> +static int ipmi_strcasecmp(const char *s1, const char *s2)
> +{
> +	while (*s1 || *s2) {
> +		if (!*s1)
> +			return -1;
> +		if (!*s2)
> +			return 1;
> +		if (*s1 != *s2)
> +			return *s1 - *s2;
> +		s1++;
> +		s2++;
> +	}
> +	return 0;
> +}

Please put a newline between functions.

> +static int parse_str(struct hotmod_vals *v, int *val, char *name, char **curr)
> +{
> +	char *s;
> +	int  i;
> +
> +	s = strchr(*curr, ',');
> +	if (!s) {
> +		printk(KERN_WARNING PFX "No hotmod %s given.\n", name);
> +		return -EINVAL;
> +	}
> +	*s = '\0';
> +	s++;
> +	for (i = 0; hotmod_ops[i].name; i++) {
> +		if (ipmi_strcasecmp(*curr, v[i].name) == 0) {
> +			*val = v[i].val;
> +			*curr = s;
> +			return 0;
> +		}
> +	}
> +
> +	printk(KERN_WARNING PFX "Invalid hotmod %s '%s'\n", name, *curr);
> +	return -EINVAL;
> +}

Does this driver really need case-insensitive string comparision?

<greps the tree for casecmp, sighs>

That doesn't look like a case-insensitive string compare to me.  What's up?

> ...
>
> +		while (s) {
> +			curr = s;
> +			s = strchr(curr, ',');
> +			if (s) {
> +				*s = '\0';
> +				s++;
> +			}
> +			o = strchr(curr, '=');
> +			if (o) {
> +				*o = '\0';
> +				o++;
> +			}
> +#define HOTMOD_INT_OPT(name, val) \
> +			if (ipmi_strcasecmp(curr, name) == 0) {		\
> +				if (!o) {				\
> +					printk(KERN_WARNING PFX		\
> +					       "No option given for '%s'\n", \
> +						curr);			\
> +					goto out;			\
> +				}					\
> +				val = simple_strtoul(o, &n, 0);		\
> +				if ((*n != '\0') || (*o == '\0')) {	\
> +					printk(KERN_WARNING PFX		\
> +					       "Bad option given for '%s'\n", \
> +					       curr);			\
> +					goto out;			\
> +				}					\
> +			}
> +
> +			HOTMOD_INT_OPT("rsp", regspacing)
> +			else HOTMOD_INT_OPT("rsi", regsize)
> +			else HOTMOD_INT_OPT("rsh", regshift)
> +			else HOTMOD_INT_OPT("irq", irq)
> +			else HOTMOD_INT_OPT("ipmb", ipmb)

oh yuk.  Can't this be done via a function or something?



      reply	other threads:[~2006-12-03 21:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-02  4:36 Corey Minyard
2006-12-03 21:26 ` Andrew Morton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061203132615.3cda55c7.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minyard@acm.org \
    --cc=openipmi-developer@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®