From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rune.pobox.com (rune.pobox.com [208.210.124.79]) by ozlabs.org (Postfix) with ESMTP id 9F16767A3F for ; Wed, 28 Jun 2006 14:06:09 +1000 (EST) Date: Tue, 27 Jun 2006 23:05:40 -0500 From: Nathan Lynch To: Stephen Rothwell Subject: Re: [PATCH] Make lparcfg.c work when both iseries and pseries are selected Message-ID: <20060628040539.GW16029@localdomain> References: <20060628115728.17f1a04d.sfr@canb.auug.org.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <20060628115728.17f1a04d.sfr@canb.auug.org.au> Cc: ppc-dev , paulus@samba.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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.