From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yanfei Zhang Subject: Re: [PATCH v3 4/5] Sysfs: Export VMCSINFO via sysfs Date: Thu, 28 Jun 2012 17:54:30 +0800 Message-ID: <4FEC29D6.5020109@cn.fujitsu.com> References: <4FEAC945.50700@cn.fujitsu.com> <4FEACA5E.4090009@cn.fujitsu.com> <20120627192236.GB1965@kroah.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Avi Kivity , mtosatti@redhat.com, ebiederm@xmission.com, luto@mit.edu, Joerg Roedel , dzickus@redhat.com, paul.gortmaker@windriver.com, ludwig.nussel@suse.de, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kexec@lists.infradead.org To: Greg KH Return-path: In-Reply-To: <20120627192236.GB1965@kroah.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org =E4=BA=8E 2012=E5=B9=B406=E6=9C=8828=E6=97=A5 03:22, Greg KH =E5=86=99=E9= =81=93: > On Wed, Jun 27, 2012 at 04:54:54PM +0800, Yanfei Zhang wrote: >> This patch export offsets of fields via /sys/devices/cpu/vmcs/. >> Individual offsets are contained in subfiles named by the filed's >> encoding, e.g.: /sys/devices/cpu/vmcs/0800 >> >> Signed-off-by: zhangyanfei >> --- >> drivers/base/core.c | 13 +++++++++++++ >> 1 files changed, 13 insertions(+), 0 deletions(-) >> >> diff --git a/drivers/base/core.c b/drivers/base/core.c >> index 346be8b..dd05ee7 100644 >> --- a/drivers/base/core.c >> +++ b/drivers/base/core.c >> @@ -26,6 +26,7 @@ >> #include >> #include >> #include >> +#include >=20 > Did you just break the build on all other arches? Not nice. >=20 >> @@ -1038,6 +1039,11 @@ int device_add(struct device *dev) >> error =3D dpm_sysfs_add(dev); >> if (error) >> goto DPMError; >> +#if defined(CONFIG_KVM_INTEL) || defined(CONFIG_KVM_INTEL_MODULE) >> + error =3D vmcs_sysfs_add(dev); >> + if (error) >> + goto VMCSError; >> +#endif >=20 > Oh my no, that's no way to ever do this, you know better than that, > please fix. >=20 > greg k-h >=20 Sorry for my thoughtless, Here is the new patch. --- drivers/base/core.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index 346be8b..7b5266a 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -30,6 +30,13 @@ #include "base.h" #include "power/power.h" =20 +#if defined(CONFIG_KVM_INTEL) || defined(CONFIG_KVM_INTEL_MODULE) +#include +#else +static inline int vmcs_sysfs_add(struct device *dev) { return 0; } +static inline void vmcs_sysfs_remove(struct device *dev) { } +#endif + #ifdef CONFIG_SYSFS_DEPRECATED #ifdef CONFIG_SYSFS_DEPRECATED_V2 long sysfs_deprecated =3D 1; @@ -1038,6 +1045,9 @@ int device_add(struct device *dev) error =3D dpm_sysfs_add(dev); if (error) goto DPMError; + error =3D vmcs_sysfs_add(dev); + if (error) + goto VMCSError; device_pm_add(dev); =20 /* Notify clients of device addition. This call must come @@ -1069,6 +1079,8 @@ int device_add(struct device *dev) done: put_device(dev); return error; + VMCSError: + dpm_sysfs_remove(dev); DPMError: bus_remove_device(dev); BusError: @@ -1171,6 +1183,7 @@ void device_del(struct device *dev) blocking_notifier_call_chain(&dev->bus->p->bus_notifier, BUS_NOTIFY_DEL_DEVICE, dev); device_pm_remove(dev); + vmcs_sysfs_remove(dev); dpm_sysfs_remove(dev); if (parent) klist_del(&dev->p->knode_parent); --=20 1.7.1