aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRoman Fietze <roman.fietze@telemotive.de>2010-03-05 02:27:39 -0500
committerJeff Garzik <jgarzik@redhat.com>2010-05-14 17:08:02 -0400
commitec569af8584e977a3474c197da53ae2ba5823caf (patch)
tree05f5397c2db2b8035f2df4a125277cf807e8765a /drivers
parent441577efa0dc9ae40fb72c602896fc76a87c0a3a (diff)
pata_mpc52xx: reduce code size by simple change of constant data types
I've prepared a totally simple patch that, if I did it and measured it correctly, reduces the text size as of the ppc-6xx-size command of pata-mpc52xx by more than 10%, by reducing the rodata size from 0x4a4 to 0x17e bytes. This is simply done by changing the data types of the ATA timing constants. If you are interested at all, and it's worth the trouble, here the details: ppc-6xx-size: text data bss dec hex filename old: 6532 1068 0 7600 1db0 pata-mpc52xx.o new: 5718 1068 0 6786 1a82 pata-mpc52xx.o The (assembler) code itself doesn't really change very much. I double checked the final results inside mpc52xx-ata-apply-timings() and they match. The driver is still working fine of course. Signed-off-by: Roman Fietze <roman.fietze@telemotive.de> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/pata_mpc52xx.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c
index 9f5b053611dd..96b11b604ae0 100644
--- a/drivers/ata/pata_mpc52xx.c
+++ b/drivers/ata/pata_mpc52xx.c
@@ -64,13 +64,13 @@ struct mpc52xx_ata_priv {
64 64
65 65
66/* ATAPI-4 PIO specs (in ns) */ 66/* ATAPI-4 PIO specs (in ns) */
67static const int ataspec_t0[5] = {600, 383, 240, 180, 120}; 67static const u16 ataspec_t0[5] = {600, 383, 240, 180, 120};
68static const int ataspec_t1[5] = { 70, 50, 30, 30, 25}; 68static const u16 ataspec_t1[5] = { 70, 50, 30, 30, 25};
69static const int ataspec_t2_8[5] = {290, 290, 290, 80, 70}; 69static const u16 ataspec_t2_8[5] = {290, 290, 290, 80, 70};
70static const int ataspec_t2_16[5] = {165, 125, 100, 80, 70}; 70static const u16 ataspec_t2_16[5] = {165, 125, 100, 80, 70};
71static const int ataspec_t2i[5] = { 0, 0, 0, 70, 25}; 71static const u16 ataspec_t2i[5] = { 0, 0, 0, 70, 25};
72static const int ataspec_t4[5] = { 30, 20, 15, 10, 10}; 72static const u16 ataspec_t4[5] = { 30, 20, 15, 10, 10};
73static const int ataspec_ta[5] = { 35, 35, 35, 35, 35}; 73static const u16 ataspec_ta[5] = { 35, 35, 35, 35, 35};
74 74
75#define CALC_CLKCYC(c,v) ((((v)+(c)-1)/(c))) 75#define CALC_CLKCYC(c,v) ((((v)+(c)-1)/(c)))
76 76
@@ -78,13 +78,13 @@ static const int ataspec_ta[5] = { 35, 35, 35, 35, 35};
78 78
79/* ATAPI-4 MDMA specs (in clocks) */ 79/* ATAPI-4 MDMA specs (in clocks) */
80struct mdmaspec { 80struct mdmaspec {
81 u32 t0M; 81 u8 t0M;
82 u32 td; 82 u8 td;
83 u32 th; 83 u8 th;
84 u32 tj; 84 u8 tj;
85 u32 tkw; 85 u8 tkw;
86 u32 tm; 86 u8 tm;
87 u32 tn; 87 u8 tn;
88}; 88};
89 89
90static const struct mdmaspec mdmaspec66[3] = { 90static const struct mdmaspec mdmaspec66[3] = {
@@ -101,23 +101,23 @@ static const struct mdmaspec mdmaspec132[3] = {
101 101
102/* ATAPI-4 UDMA specs (in clocks) */ 102/* ATAPI-4 UDMA specs (in clocks) */
103struct udmaspec { 103struct udmaspec {
104 u32 tcyc; 104 u8 tcyc;
105 u32 t2cyc; 105 u8 t2cyc;
106 u32 tds; 106 u8 tds;
107 u32 tdh; 107 u8 tdh;
108 u32 tdvs; 108 u8 tdvs;
109 u32 tdvh; 109 u8 tdvh;
110 u32 tfs; 110 u8 tfs;
111 u32 tli; 111 u8 tli;
112 u32 tmli; 112 u8 tmli;
113 u32 taz; 113 u8 taz;
114 u32 tzah; 114 u8 tzah;
115 u32 tenv; 115 u8 tenv;
116 u32 tsr; 116 u8 tsr;
117 u32 trfs; 117 u8 trfs;
118 u32 trp; 118 u8 trp;
119 u32 tack; 119 u8 tack;
120 u32 tss; 120 u8 tss;
121}; 121};
122 122
123static const struct udmaspec udmaspec66[6] = { 123static const struct udmaspec udmaspec66[6] = {
@@ -270,7 +270,7 @@ mpc52xx_ata_compute_pio_timings(struct mpc52xx_ata_priv *priv, int dev, int pio)
270{ 270{
271 struct mpc52xx_ata_timings *timing = &priv->timings[dev]; 271 struct mpc52xx_ata_timings *timing = &priv->timings[dev];
272 unsigned int ipb_period = priv->ipb_period; 272 unsigned int ipb_period = priv->ipb_period;
273 unsigned int t0, t1, t2_8, t2_16, t2i, t4, ta; 273 u32 t0, t1, t2_8, t2_16, t2i, t4, ta;
274 274
275 if ((pio < 0) || (pio > 4)) 275 if ((pio < 0) || (pio > 4))
276 return -EINVAL; 276 return -EINVAL;
@@ -299,8 +299,8 @@ mpc52xx_ata_compute_mdma_timings(struct mpc52xx_ata_priv *priv, int dev,
299 if (speed < 0 || speed > 2) 299 if (speed < 0 || speed > 2)
300 return -EINVAL; 300 return -EINVAL;
301 301
302 t->mdma1 = (s->t0M << 24) | (s->td << 16) | (s->tkw << 8) | (s->tm); 302 t->mdma1 = ((u32)s->t0M << 24) | ((u32)s->td << 16) | ((u32)s->tkw << 8) | s->tm;
303 t->mdma2 = (s->th << 24) | (s->tj << 16) | (s->tn << 8); 303 t->mdma2 = ((u32)s->th << 24) | ((u32)s->tj << 16) | ((u32)s->tn << 8);
304 t->using_udma = 0; 304 t->using_udma = 0;
305 305
306 return 0; 306 return 0;
@@ -316,11 +316,11 @@ mpc52xx_ata_compute_udma_timings(struct mpc52xx_ata_priv *priv, int dev,
316 if (speed < 0 || speed > 2) 316 if (speed < 0 || speed > 2)
317 return -EINVAL; 317 return -EINVAL;
318 318
319 t->udma1 = (s->t2cyc << 24) | (s->tcyc << 16) | (s->tds << 8) | s->tdh; 319 t->udma1 = ((u32)s->t2cyc << 24) | ((u32)s->tcyc << 16) | ((u32)s->tds << 8) | s->tdh;
320 t->udma2 = (s->tdvs << 24) | (s->tdvh << 16) | (s->tfs << 8) | s->tli; 320 t->udma2 = ((u32)s->tdvs << 24) | ((u32)s->tdvh << 16) | ((u32)s->tfs << 8) | s->tli;
321 t->udma3 = (s->tmli << 24) | (s->taz << 16) | (s->tenv << 8) | s->tsr; 321 t->udma3 = ((u32)s->tmli << 24) | ((u32)s->taz << 16) | ((u32)s->tenv << 8) | s->tsr;
322 t->udma4 = (s->tss << 24) | (s->trfs << 16) | (s->trp << 8) | s->tack; 322 t->udma4 = ((u32)s->tss << 24) | ((u32)s->trfs << 16) | ((u32)s->trp << 8) | s->tack;
323 t->udma5 = (s->tzah << 24); 323 t->udma5 = (u32)s->tzah << 24;
324 t->using_udma = 1; 324 t->using_udma = 1;
325 325
326 return 0; 326 return 0;