Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1214134
| From | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | RE: [PATCH 1/1] irqchip: imx-gpcv2: Simplify the implemenation |
| Date | 2015-08-26 21:00 +0200 |
| Message-ID | <q1O5s-5Pg-23@gated-at.bofh.it> (permalink) |
| References | <q1LqX-2d7-69@gated-at.bofh.it> <q1LqX-2d7-67@gated-at.bofh.it> <q1LTX-2LN-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, 26 Aug 2015, Shenwei Wang wrote:
> > From: Thomas Gleixner [mailto:tglx@linutronix.de]
> > > + cd = imx_gpcv2_instance;
> > > + if (!cd)
> > > return 0;
> > >
> > > + for (i = 0; i < IMR_NUM; i++) {
> > > + reg = cd->gpc_base + cd->cpu2wakeup + i * 4;
> > > + cd->wakeup_sources[i] = readl_relaxed(reg);
> > > + }
> > > +
> > > if (sources)
> > > - *sources = imx_gpcv2_instance->wakeup_sources;
> > > + *sources = cd->wakeup_sources;
> > >
> > > return IMR_NUM;
> >
> > You do not need the intermediate storage at all.
> >
> > u32 imx_gpcv2_get_wakeup_source(u32 *sources) {
> > if (sources) {
> > for (i = 0; i < IMR_NUM; i++) {
> > reg = cd->gpc_base + cd->cpu2wakeup + i * 4;
> > sources[i] = readl_relaxed(reg);
> > }
> > }
> > ....
>
> Using the intermediate storage here can make the caller a little easier,
> because the caller does not need to malloc the memory before the call.
> Especially the caller does not even know how many memory to allocate
> In the beginning.
Fair enough, but why do you need that case where sources can be NULL
just to return IMR_NUM?
Thanks,
tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH 1/1] irqchip: imx-gpcv2: Simplify the implemenation Thomas Gleixner <tglx@linutronix.de> - 2015-08-26 18:10 +0200
RE: [PATCH 1/1] irqchip: imx-gpcv2: Simplify the implemenation Shenwei Wang <Shenwei.Wang@freescale.com> - 2015-08-26 18:40 +0200
RE: [PATCH 1/1] irqchip: imx-gpcv2: Simplify the implemenation Thomas Gleixner <tglx@linutronix.de> - 2015-08-26 21:00 +0200
RE: [PATCH 1/1] irqchip: imx-gpcv2: Simplify the implemenation Shenwei Wang <Shenwei.Wang@freescale.com> - 2015-08-26 21:10 +0200
csiph-web