From: Shaohua Li <shaohua.li@intel.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, zwane@arm.linux.org.uk,
ncunningham@cyclades.com, ak@muc.de, pavel@ucw.cz
Subject: Re: [PATCH]MTRR suspend/resume cleanup
Date: Tue, 28 Jun 2005 14:24:36 +0800 [thread overview]
Message-ID: <1119939877.3832.1.camel@linux-hp.sh.intel.com> (raw)
In-Reply-To: <20050627222444.370457d4.akpm@osdl.org>
On Tue, 2005-06-28 at 13:24 +0800, Andrew Morton wrote:
> > @@ -332,6 +332,7 @@ int mtrr_add_page(unsigned long base, un
> >
> > error = -EINVAL;
> >
> > + lock_cpu_hotplug();
> > /* Search for existing MTRR */
> > down(&main_lock);
> > for (i = 0; i < num_var_ranges; ++i) {
>
> Is this new locking? If so, please describe it.
> > +
> > +static int __init mtrr_init_finialize(void)
> > +{
> > + if (!mtrr_if)
> > + return 0;
> > + if (use_intel())
> > + mtrr_state_warn();
> > + else
> > + /* The CPUs haven't MTRR and seemes not support SMP. They have
> specific
> > + * drivers, we use a tricky method to support suspend/resume
> for them
> > + * TBD: is there any system with such CPU which supports
> suspend/resume?
> > + * if no, we should remove the code.
> > + */
> > + sysdev_driver_register(&cpu_sysdev_class,
> > + &mtrr_sysdev_driver);
> > + return 0;
> > +}
>
> That's pretty hard to read. Braces will improve it:
>
> if (use_intel()) {
> mtrr_state_warn();
> } else {
> /*
> * The CPUs haven't MTRR and seemes not support SMP.
> They have
> * specific drivers, we use a tricky method to support
> * suspend/resume for them.
> * TBD: is there any system with such CPU which
> supports
> * suspend/resume? If no, we should remove the code.
> */
> sysdev_driver_register(&cpu_sysdev_class,
> &mtrr_sysdev_driver);
> }
>
> > +#ifdef CONFIG_MTRR
> > +extern int mtrr_ap_init(void);
> > +extern int mtrr_bp_init(void);
> > +#else
> > +#define mtrr_ap_init()
> > +#define mtrr_bp_init()
> > +#endif
>
> If this works, it means we're always ignoring the return values and
> these
> things should return void.
>
> Otherwise the !CONFIG_MTRR stubs should be returning an integer. So
> we
> need either:
>
> #ifdef CONFIG_MTRR
> extern void mtrr_ap_init(void);
> extern void mtrr_bp_init(void);
> #else
> #define mtrr_ap_init() do {} while (0) (or static inlines)
> #define mtrr_bp_init() do {} while (0)
> #endif
>
> or
>
> #ifdef CONFIG_MTRR
> extern int mtrr_ap_init(void);
> extern int mtrr_bp_init(void);
> #else
> static inline int mtrr_ap_init(void) { return 0; }
> static inline int mtrr_bp_init(void) { return 0; }
> #endif
> > +#ifdef CONFIG_MTRR
> > +extern int mtrr_ap_init(void);
> > +extern int mtrr_bp_init(void);
> > +#else
> > +#define mtrr_ap_init()
> > +#define mtrr_bp_init();
> > +#endif
> Ditto.
Thanks for your feedback. I will update the patch when I collect all
comments.
Thanks,
Shaohua
next prev parent reply other threads:[~2005-06-28 7:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-28 5:22 [PATCH]MTRR suspend/resume cleanup Shaohua Li
2005-06-28 5:24 ` Andrew Morton
2005-06-28 6:24 ` Shaohua Li [this message]
2005-06-30 2:13 ` Shaohua Li
2005-06-30 2:08 ` Andrew Morton
2005-06-30 2:24 ` Shaohua Li
2005-06-30 8:26 ` Andi Kleen
2005-06-28 6:30 ` Nigel Cunningham
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=1119939877.3832.1.camel@linux-hp.sh.intel.com \
--to=shaohua.li@intel.com \
--cc=ak@muc.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ncunningham@cyclades.com \
--cc=pavel@ucw.cz \
--cc=zwane@arm.linux.org.uk \
/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