Prev: security:key.c Fix warning: variable 'key' set but not used
Next: block:cryptoloop Fix warning: variable 'cipher' set but not used
From: Jiri Kosina on 20 Jul 2010 11:10 On Mon, 28 Jun 2010, Kulikov Vasiliy wrote: > Change sizeof(x) / sizeof(*x) to ARRAY_SIZE(x). > > Signed-off-by: Kulikov Vasiliy <segooon(a)gmail.com> > --- > drivers/gpu/drm/drm_edid.c | 7 ++----- > 1 files changed, 2 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > index c198186..da06476 100644 > --- a/drivers/gpu/drm/drm_edid.c > +++ b/drivers/gpu/drm/drm_edid.c > @@ -929,13 +929,11 @@ drm_mode_do_interlace_quirk(struct drm_display_mode *mode, > { 1440, 576 }, > { 2880, 576 }, > }; > - static const int n_sizes = > - sizeof(cea_interlaced)/sizeof(cea_interlaced[0]); > > if (!(pt->misc & DRM_EDID_PT_INTERLACED)) > return; > > - for (i = 0; i < n_sizes; i++) { > + for (i = 0; i < ARRAY_SIZE(cea_interlaced); i++) { > if ((mode->hdisplay == cea_interlaced[i].w) && > (mode->vdisplay == cea_interlaced[i].h / 2)) { > mode->vdisplay *= 2; > @@ -1375,7 +1373,6 @@ static const struct { > { 1920, 1440, 60, 0 }, > { 1920, 1440, 75, 0 }, > }; > -static const int num_est3_modes = sizeof(est3_modes) / sizeof(est3_modes[0]); > > static int > drm_est3_modes(struct drm_connector *connector, struct detailed_timing *timing) > @@ -1387,7 +1384,7 @@ drm_est3_modes(struct drm_connector *connector, struct detailed_timing *timing) > for (i = 0; i < 6; i++) { > for (j = 7; j > 0; j--) { > m = (i * 8) + (7 - j); > - if (m >= num_est3_modes) > + if (m >= ARRAY_SIZE(est3_modes)) > break; > if (est[i] & (1 << j)) { > mode = drm_mode_find_dmt(connector->dev, Not found in linux-next as of today. Applied, thanks. -- Jiri Kosina SUSE Labs, Novell Inc. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Jiri Kosina on 20 Jul 2010 11:10 On Mon, 28 Jun 2010, Miller, Mike (OS Dev) wrote: > > Change sizeof(x) / sizeof(*x) to ARRAY_SIZE(x). > > > > Signed-off-by: Kulikov Vasiliy <segooon(a)gmail.com> > Acked-by: Mike Miller <mike.miller(a)hp.com> Not present in linux-next as of today. Applied, thanks. -- Jiri Kosina SUSE Labs, Novell Inc. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Jiri Kosina on 20 Jul 2010 11:20
On Mon, 28 Jun 2010, Kulikov Vasiliy wrote: > Change sizeof(x) / sizeof(*x) to ARRAY_SIZE(x). > > Signed-off-by: Kulikov Vasiliy <segooon(a)gmail.com> > --- > drivers/scsi/bfa/bfa_fcs.c | 10 ++++------ > 1 files changed, 4 insertions(+), 6 deletions(-) > > diff --git a/drivers/scsi/bfa/bfa_fcs.c b/drivers/scsi/bfa/bfa_fcs.c > index 3516172..153cb2a 100644 > --- a/drivers/scsi/bfa/bfa_fcs.c > +++ b/drivers/scsi/bfa/bfa_fcs.c > @@ -86,7 +86,7 @@ bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad, > bfa_attach_fcs(bfa); > fcbuild_init(); > > - for (i = 0; i < sizeof(fcs_modules) / sizeof(fcs_modules[0]); i++) { > + for (i = 0; i < ARRAY_SIZE(fcs_modules); i++) { > mod = &fcs_modules[i]; > if (mod->attach) > mod->attach(fcs); > @@ -102,7 +102,7 @@ bfa_fcs_init(struct bfa_fcs_s *fcs) > int i; > struct bfa_fcs_mod_s *mod; > > - for (i = 0; i < sizeof(fcs_modules) / sizeof(fcs_modules[0]); i++) { > + for (i = 0; i < ARRAY_SIZE(fcs_modules); i++) { > mod = &fcs_modules[i]; > if (mod->modinit) > mod->modinit(fcs); > @@ -163,13 +163,11 @@ void > bfa_fcs_exit(struct bfa_fcs_s *fcs) > { > struct bfa_fcs_mod_s *mod; > - int nmods, i; > + int i; > > bfa_wc_init(&fcs->wc, bfa_fcs_exit_comp, fcs); > > - nmods = sizeof(fcs_modules) / sizeof(fcs_modules[0]); > - > - for (i = 0; i < nmods; i++) { > + for (i = 0; i < ARRAY_SIZE(fcs_modules); i++) { > > mod = &fcs_modules[i]; > if (mod->modexit) { I have folded this patch into the other bfa change you made, and applied. Thanks, -- Jiri Kosina SUSE Labs, Novell Inc. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |