From: tglx@linutronix.de (Thomas Gleixner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V5 1/2] irqchip: imx-gpcv2: IMX GPCv2 driver for wakeup sources
Date: Tue, 21 Jul 2015 23:37:34 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.11.1507212324230.18576@nanos> (raw)
In-Reply-To: <BL2PR03MB370168620C55576F4A7750683840@BL2PR03MB370.namprd03.prod.outlook.com>
On Tue, 21 Jul 2015, Shenwei Wang wrote:
> > On Tue, 21 Jul 2015, Shenwei Wang wrote:
> > > This struct defines the properties and functions that GPCv2 block
> > > provides. Since GPCv2 has two key functions: Irq wakeup source
> > > management and power management, the intention of the struct is to
> > > share data and methods among irqchip, suspend, and cpuidle drivers.
> >
> > I don't think this is a good idea. The cpuidle driver has nothing to know about the
> > internals of the irq driver and vice versa. Neither does the suspend code.
> >
> > If you failed to split that proper then your design is wrong.
> >
> The implementation has already been spitted totally. The question is
> if we use the same structure among those drivers or not, since they
> do share some common data like gpc_base address, enabled_irq, and
> mfmix_mask. The suspend and cpuidle driver will use those data to
> decide the hardware power modes and the relating power down sequence
> of the power domains. The structure is the abstract of the GPCv2
> hardware, and the current struct declaration matches the low level
> hardware well. Although it is possible and easy to split it into
> two, it may introduce either redundant definition for the common
> properties or have to create a global variable to enable them
> visible to both the irqchip and the suspend codes.
So the proper way to do this is:
Have a data structure which contains only the shared information. The
pointer to this structure can be global.
Have per driver data structures which contain the driver private
stuff.
Think about whether you need all the function pointers in one of the
structs. IOW, you need them only if a pointer can be changed at
runtime. If not you can call the function directly as I doubt that any
of these drivers can be modular.
Thanks,
tglx
next prev parent reply other threads:[~2015-07-21 21:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-17 16:24 [PATCH V5 0/2] IMX GPCv2 drivers for wakeup source and suspend Shenwei Wang
2015-07-17 16:24 ` [PATCH V5 1/2] irqchip: imx-gpcv2: IMX GPCv2 driver for wakeup sources Shenwei Wang
2015-07-17 21:49 ` Thomas Gleixner
2015-07-21 15:07 ` Shenwei Wang
2015-07-21 16:51 ` Thomas Gleixner
2015-07-21 18:41 ` Shenwei Wang
2015-07-21 21:37 ` Thomas Gleixner [this message]
2015-07-17 16:25 ` [PATCH V5 2/2] ARM: imx: Add suspend codes for imx7D Shenwei Wang
-- strict thread matches above, loose matches on Subject: below --
2015-07-17 15:52 [PATCH V5 0/2] IMX GPCv2 drivers for wakeup source and suspend Shenwei Wang
2015-07-17 15:52 ` [PATCH V5 1/2] irqchip: imx-gpcv2: IMX GPCv2 driver for wakeup sources Shenwei Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.11.1507212324230.18576@nanos \
--to=tglx@linutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox