From: Nathan Lynch <ntl@pobox.com>
To: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: ppc-dev <linuxppc-dev@ozlabs.org>, paulus@samba.org
Subject: Re: [PATCH] Make lparcfg.c work when both iseries and pseries are selected
Date: Tue, 27 Jun 2006 23:05:40 -0500 [thread overview]
Message-ID: <20060628040539.GW16029@localdomain> (raw)
In-Reply-To: <20060628115728.17f1a04d.sfr@canb.auug.org.au>
Stephen Rothwell wrote:
> static ssize_t lparcfg_write(struct file *file, const char __user * buf,
> size_t count, loff_t * off)
> {
> + ssize_t retval = -ENOMEM;
> +#ifdef CONFIG_PPC_PSERIES
> char *kbuf;
> char *tmp;
> u64 new_entitled, *new_entitled_ptr = &new_entitled;
> @@ -479,8 +476,6 @@ static ssize_t lparcfg_write(struct file
> unsigned long resource;
> u8 current_weight;
>
> - ssize_t retval = -ENOMEM;
> -
> kbuf = kmalloc(count, GFP_KERNEL);
> if (!kbuf)
> goto out;
> @@ -546,11 +541,10 @@ static ssize_t lparcfg_write(struct file
>
> out:
> kfree(kbuf);
> +#endif /* CONFIG_PPC_PSERIES */
> return retval;
> }
Erm... this is kind of gross, and will return -ENOMEM on iSeries when
it should really return -ENOSYS (I think).
Would it be over-engineering to have an lparcfg_ops struct, with
lparcfg_read and lparcfg_write methods (and the latter would be null
on iSeries)? All the additional #ifdeffery doesn't really improve
the readability of this code IMO.
next prev parent reply other threads:[~2006-06-28 4:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-28 1:57 [PATCH] Make lparcfg.c work when both iseries and pseries are selected Stephen Rothwell
2006-06-28 4:05 ` Nathan Lynch [this message]
2006-06-28 6:19 ` Stephen Rothwell
2006-06-28 7:29 ` Nathan Lynch
2006-06-29 5:07 ` Stephen Rothwell
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=20060628040539.GW16029@localdomain \
--to=ntl@pobox.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=paulus@samba.org \
--cc=sfr@canb.auug.org.au \
/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;
as well as URLs for NNTP newsgroup(s).