Re: [PATCH 1/2] pinctrl: samsung: fix suspend/resume functionality

From: Heiko Stübner
Date: Thu May 16 2013 - 17:20:13 EST


Am Donnerstag, 16. Mai 2013, 21:19:20 schrieb Tomasz Figa:
[...]
> > +
> > + if (type->fld_width[PINCFG_TYPE_CON_PDN]) {
> > + bank->pm_save.conpdn = readl(reg +
> > + type->reg_offset[PINCFG_TYPE_CON_PDN]);
> > + bank->pm_save.pudpdn = readl(reg +
> > + type->reg_offset[PINCFG_TYPE_PUD_PDN]);
> > + }
>
> I wonder if you couldn't do all the saving here in a single loop over all
> pin control types, like:
>
> unsigned int offsets = bank->type->reg_offsets;
> unsigned int widths = bank->type->fld_width;
>
> for (i = 0; i < PINCFG_TYPE_NUM; ++i)
> if (widths[i])
> bank->pm_save[i] = readl(reg + offsets[i]);
>
> The only thing not handled by this loop is second CON registers in banks
> with two of them. I can't think of any better solution for this other than
> just adding a special case after the loop.

doing this in the loop over the pinctrl types like Tomasz suggests, also
nicely fixes the problem of s3c24xx [0] only having FUNC, DAT and PUD and some
(gpa) not even having the PUD, which was not checked in the original patch.


Heiko

[0] patch is with Kgene currently, so should make it into 3.11
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/