From mboxrd@z Thu Jan 1 00:00:00 1970 From: Doug Goldstein Subject: Re: [PATCH v6 1/3] Kconfig: import kconfig.h from Linux 4.3 Date: Sat, 30 Jan 2016 22:08:15 -0600 Message-ID: <56AD88AF.5020800@cardoe.com> References: <1454147250-7704-1-git-send-email-zhaoshenglong@huawei.com> <1454147250-7704-2-git-send-email-zhaoshenglong@huawei.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1412039746611954693==" Return-path: In-Reply-To: <1454147250-7704-2-git-send-email-zhaoshenglong@huawei.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Shannon Zhao , xen-devel@lists.xen.org Cc: shannon.zhao@linaro.org, jbeulich@suse.com, peter.huangpeng@huawei.com List-Id: xen-devel@lists.xenproject.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --===============1412039746611954693== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="u84gxlR2or1Uxj4bLdi8j1fDdXCKOcRsk" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --u84gxlR2or1Uxj4bLdi8j1fDdXCKOcRsk Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 1/30/16 3:47 AM, Shannon Zhao wrote: > From: Shannon Zhao >=20 > To support using CONFIG_ options in C/CPP expressions, import kconfig.h= > from the Linux v4.3 tag (commit id > 6a13feb9c82803e2b815eca72fa7a9f5561d7861). > Only import IS_ENABLED for Xen since Xen doesn't support loadable > modules. >=20 > CC: Doug Goldstein > Signed-off-by: Shannon Zhao Reviewed-by: Doug Goldstein > --- > xen/include/xen/kconfig.h | 31 +++++++++++++++++++++++++++++++ > 1 file changed, 31 insertions(+) > create mode 100644 xen/include/xen/kconfig.h >=20 > diff --git a/xen/include/xen/kconfig.h b/xen/include/xen/kconfig.h > new file mode 100644 > index 0000000..4d58c5b > --- /dev/null > +++ b/xen/include/xen/kconfig.h > @@ -0,0 +1,31 @@ > +#ifndef __XEN_KCONFIG_H > +#define __XEN_KCONFIG_H > + > +#include > + > +/* > + * Helper macros to use CONFIG_ options in C/CPP expressions. Note tha= t > + * these only work with boolean option. > + */ > + > +/* > + * Getting something that works in C and CPP for an arg that may or ma= y > + * not be defined is tricky. Here, if we have "#define CONFIG_BOOGER = 1" > + * we match on the placeholder define, insert the "0," for arg1 and ge= nerate > + * the triplet (0, 1, 0). Then the last step cherry picks the 2nd arg= (a one). > + * When CONFIG_BOOGER is not defined, we generate a (... 1, 0) pair, a= nd when > + * the last step cherry picks the 2nd arg, we get a zero. > + */ > +#define __ARG_PLACEHOLDER_1 0, > +#define config_enabled(cfg) _config_enabled(cfg) > +#define _config_enabled(value) __config_enabled(__ARG_PLACEHOLDER_##va= lue) > +#define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk = 1, 0) > +#define ___config_enabled(__ignored, val, ...) val > + > +/* > + * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y', = 0 > + * otherwise. > + */ > +#define IS_ENABLED(option) config_enabled(option) > + > +#endif /* __XEN_KCONFIG_H */ >=20 --=20 Doug Goldstein --u84gxlR2or1Uxj4bLdi8j1fDdXCKOcRsk Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0 iQJ8BAEBCgBmBQJWrYi1XxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRBNTM5MEQ2RTNFMTkyNzlCNzVDMzIwOTVB MkJDMDNEQzg3RUQxQkQ0AAoJEKK8A9yH7RvUGAQP/ies9lIF3vtyvZbxpS+HnDQa E3GVPQfsYI7X83n8LbaFbV5gHuAtbcHM4wZiq9n5dP7XB25hT87SMvONiBarlcgD Zg1po/d37DGCRVBip9DVK/qLohozPxC/xWia39txMssrUVy1HfIPrsuZW8Bwf6hD 38wJ6WaJvCT+osagqvCdsEsaE3+1YgO0TdYJgFZ8PpJK72got1kYv4HOGti6Sfbw Z74qhzqoewcAtrtv3yff21qOfvCERRsbfoVHIf/rw2A0ePFcUcysz4V9X7Zu+zOW wBsTTpuJuVKvbl2DjvtfO657AVHNEbus4jMhr4WA9SflLdp6fHBz1DJKPmM9D1FC wMzovwKwFrTaRoYvNPX/g/O2WD57iFIXJmhUZqKtDK0jxrWn3oevYBoCQ/Zan1YA HlTgWE3N4XXKNGrL/uEmN8PNs4VXJE4SXYGmYQwFBToxNdwdkaDtm2x1zSySKV6T YI3YCMy6PT/e4WdqOkip76INrxpJqdoehSSIfjygcOZPRz8Ifk1AqvwHFdcuxvpS KW0JvSjtJH54SW+UB9IAKKv3khKZRE/9foy0nsmDbJSXuX72uFeDbjZCLlu3qw9z DU4aLbzcGL+lRKqjExuoTstsZUqql/P0qAaXjeHejPy8gfkgKkhmaF3StIuGiWBy 9O1xsX6lwyCERppcASaA =EgPH -----END PGP SIGNATURE----- --u84gxlR2or1Uxj4bLdi8j1fDdXCKOcRsk-- --===============1412039746611954693== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============1412039746611954693==--