From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hannes Reinecke Subject: Re: [PATCH 2/3] debloat aic7xxx and aic79xx drivers Date: Tue, 08 Apr 2008 14:23:30 +0200 Message-ID: <47FB63C2.4030006@suse.de> References: <200803230440.40685.vda.linux@googlemail.com> <200803230442.02771.vda.linux@googlemail.com> <47F9F8C9.2080807@suse.de> <200804072000.55637.vda.linux@googlemail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Received: from ns2.suse.de ([195.135.220.15]:34225 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751772AbYDHMXc (ORCPT ); Tue, 8 Apr 2008 08:23:32 -0400 In-Reply-To: <200804072000.55637.vda.linux@googlemail.com> Sender: linux-scsi-owner@vger.kernel.org List-Id: linux-scsi@vger.kernel.org To: Denys Vlasenko Cc: Andrew Morton , linux-scsi@vger.kernel.org Hi Denys, Denys Vlasenko wrote: > On Monday 07 April 2008 12:34, Hannes Reinecke wrote: >>> Adds statics, #ifdefs out huge amount of unused code, adds consts >>> >>> Signed-off-by: Denys Vlasenko >>> -- >>> vda >>> >> NACK. We need the #defines to print out the registers. >> And in either case the *_shipped files are in fact >> autogenerated by aic assembler, so we need to fix that >> one, too. >=20 > I assume you are talking about this part of a patch: >=20 > --- linux-2.6.25-rc6-aic1/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped = 2008-03-23 00:43:20.000000000 +0100 > +++ linux-2.6.25-rc6-aic2/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped = 2008-03-23 00:54:59.000000000 +0100 > @@ -11,23 +11,18 @@ typedef struct ahd_reg_parse_entry { > uint8_t value; > uint8_t mask; > } ahd_reg_parse_entry_t; >=20 > +#if 0 /* unused */ > + > #if AIC_DEBUG_REGISTERS > ahd_reg_print_t ahd_mode_ptr_print; > #else > #define ahd_mode_ptr_print(regvalue, cur_col, wrap) \ > ahd_print_register(NULL, 0, "MODE_PTR", 0x00, regvalue, cur_col,= wrap) > #endif >=20 > ..... > ..... >=20 Correct. >=20 > Let me explain what I am doing here. I am NOT deleting ahd_intstat_pr= int > definition, I am moving it below the #endif which terminates big > #if 0 /* unused */ block, moving to this place: >=20 >=20 > @@ -2377,8 +2043,346 @@ ahd_reg_print_t ahd_scb_disconnected_lis > #define ahd_scb_disconnected_lists_print(regvalue, cur_col, wrap) \ > ahd_print_register(NULL, 0, "SCB_DISCONNECTED_LISTS", 0x1b8, reg= value, cur_col, wrap) > #endif >=20 > +#endif /* unused */ > + > +#if AIC_DEBUG_REGISTERS > +ahd_reg_print_t ahd_intstat_print; > +#else > +#define ahd_intstat_print(regvalue, cur_col, wrap) \ > + ahd_print_register(NULL, 0, "INTSTAT", 0x01, regvalue, cur_col, = wrap) > +#endif > ... > ... >=20 Hmm. >=20 > #if 0 / #endif block ends up containing definitions of 290 functions/= macros, > none of which is EVER used. I used this script (below) and verified t= hat > they are never mentioned anywhere outside of *_shipped files. > I also did test builds with and without debug enabled and they build > with no problems. No undefined references! >=20 Well, still not quite. The point here is that all of the functions in t= he *_shipped files are in fact auto-generated by aicasm, based on the defi= nitions in aic79xx.seq and aic79xx.reg. So the *_reg_print.c files contains functions for all _defined_ registers, not the actually used ones. What we have to do here is to modify aicasm to not print out the unused definitions, and copy those (autogenerated) files over to the *_shipped files to have them synced properly. Hand-patching the *_shipped files is not a good idea. The const idea is a good one, and actually a one-liner to fix: diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c b/drivers/scsi= /aic7xxx/aicasm/aicasm_symbol.c index f1f448d..a7a51e4 100644 --- a/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c +++ b/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c @@ -370,7 +370,7 @@ aic_print_reg_dump_start(FILE *dfile, symbol_node_t= *regnode) return; =20 fprintf(dfile, -"static %sreg_parse_entry_t %s_parse_table[] =3D {\n", +"static const %sreg_parse_entry_t %s_parse_table[] =3D {\n", prefix, regnode->symbol->name); } Cheers, Hannes --=20 Dr. Hannes Reinecke zSeries & Storage hare@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg GF: Markus Rex, HRB 16746 (AG N=FCrnberg) -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" i= n the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html