From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: Re: [patch 2/3] ps3: BD/DVD/CD-ROM Storage Driver Date: Thu, 19 Jul 2007 02:17:52 -0700 Message-ID: <20070719021752.35cb7daa.akpm@linux-foundation.org> References: <20070716161539.075822000@pademelon.sonytel.be> <20070716162206.529280000@pademelon.sonytel.be> <20070718164351.a92ec032.akpm@linux-foundation.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+glppd-linuxppc64-dev=m.gmane.org@ozlabs.org Errors-To: linuxppc-dev-bounces+glppd-linuxppc64-dev=m.gmane.org@ozlabs.org To: Geert Uytterhoeven Cc: Jens Axboe , "James E.J. Bottomley" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Alessandro Rubini , linuxppc-dev@ozlabs.org, Paul Mackerras List-Id: linux-scsi@vger.kernel.org On Thu, 19 Jul 2007 11:02:07 +0200 (CEST) Geert Uytterhoeven wrote: > On Wed, 18 Jul 2007, Andrew Morton wrote: > > > +struct ps3rom_private { > > > + struct ps3_storage_device *dev; > > > + struct scsi_cmnd *curr_cmd; > > > +}; > > > +#define ps3rom_priv(dev) ((dev)->sbd.core.driver_data) > > > + > > > > Someone should invent a keyboard which delivers an electric shock when the > > operator types "#define". In the meanwhile, I get to do the honours. > > > > Please don't implement in a macro anything which can be implemented in C. > > All I needed was a shorthand to access driver_data, for both read and write > access (you cannot do the latter with C, unless you decouple read and write). Oh dear. ps3rom_priv(dev) = host; that's 'orrid. We have an identifier pretending to be a function, only we go and treat it as an lvalue. I mean, C code should look like C code, and the above just doesn't. Sigh. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937623AbXGSJSw (ORCPT ); Thu, 19 Jul 2007 05:18:52 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1764370AbXGSJSl (ORCPT ); Thu, 19 Jul 2007 05:18:41 -0400 Received: from smtp2.linux-foundation.org ([207.189.120.14]:43866 "EHLO smtp2.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1764275AbXGSJSk (ORCPT ); Thu, 19 Jul 2007 05:18:40 -0400 Date: Thu, 19 Jul 2007 02:17:52 -0700 From: Andrew Morton To: Geert Uytterhoeven Cc: Paul Mackerras , Jens Axboe , "James E.J. Bottomley" , Alessandro Rubini , linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, Geoff Levand Subject: Re: [patch 2/3] ps3: BD/DVD/CD-ROM Storage Driver Message-Id: <20070719021752.35cb7daa.akpm@linux-foundation.org> In-Reply-To: References: <20070716161539.075822000@pademelon.sonytel.be> <20070716162206.529280000@pademelon.sonytel.be> <20070718164351.a92ec032.akpm@linux-foundation.org> X-Mailer: Sylpheed 2.4.1 (GTK+ 2.8.17; x86_64-unknown-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 19 Jul 2007 11:02:07 +0200 (CEST) Geert Uytterhoeven wrote: > On Wed, 18 Jul 2007, Andrew Morton wrote: > > > +struct ps3rom_private { > > > + struct ps3_storage_device *dev; > > > + struct scsi_cmnd *curr_cmd; > > > +}; > > > +#define ps3rom_priv(dev) ((dev)->sbd.core.driver_data) > > > + > > > > Someone should invent a keyboard which delivers an electric shock when the > > operator types "#define". In the meanwhile, I get to do the honours. > > > > Please don't implement in a macro anything which can be implemented in C. > > All I needed was a shorthand to access driver_data, for both read and write > access (you cannot do the latter with C, unless you decouple read and write). Oh dear. ps3rom_priv(dev) = host; that's 'orrid. We have an identifier pretending to be a function, only we go and treat it as an lvalue. I mean, C code should look like C code, and the above just doesn't. Sigh.