Commit e15d0127 authored by Ricardo B. Marliere's avatar Ricardo B. Marliere Committed by Michael Ellerman

powerpc: vio: move device attributes into a new ifdef

In order to make the distinction of the vio_bus_type variable based on
CONFIG_PPC_SMLPAR more explicit, move the required structs into a new
ifdef block. This is needed in order to make vio_bus_type const and
because the distinction is made explicit, there is no need to set the
fields within the vio_cmo_sysfs_init function.
Signed-off-by: default avatar"Ricardo B. Marliere" <ricardo@marliere.net>
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240212-bus_cleanup-powerpc2-v2-1-8441b3f77827@marliere.net
parent c5aebb53
......@@ -991,18 +991,6 @@ static DEVICE_ATTR_RO(cmo_allocated);
static DEVICE_ATTR_RW(cmo_desired);
static DEVICE_ATTR_RW(cmo_allocs_failed);
static struct attribute *vio_cmo_dev_attrs[] = {
&dev_attr_name.attr,
&dev_attr_devspec.attr,
&dev_attr_modalias.attr,
&dev_attr_cmo_entitled.attr,
&dev_attr_cmo_allocated.attr,
&dev_attr_cmo_desired.attr,
&dev_attr_cmo_allocs_failed.attr,
NULL,
};
ATTRIBUTE_GROUPS(vio_cmo_dev);
/* sysfs bus functions and data structures for CMO */
#define viobus_cmo_rd_attr(name) \
......@@ -1062,11 +1050,7 @@ static struct attribute *vio_bus_attrs[] = {
};
ATTRIBUTE_GROUPS(vio_bus);
static void __init vio_cmo_sysfs_init(void)
{
vio_bus_type.dev_groups = vio_cmo_dev_groups;
vio_bus_type.bus_groups = vio_bus_groups;
}
static void __init vio_cmo_sysfs_init(void) { }
#else /* CONFIG_PPC_SMLPAR */
int vio_cmo_entitlement_update(size_t new_entitlement) { return 0; }
void vio_cmo_set_dev_desired(struct vio_dev *viodev, size_t desired) {}
......@@ -1584,14 +1568,6 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
}
static DEVICE_ATTR_RO(modalias);
static struct attribute *vio_dev_attrs[] = {
&dev_attr_name.attr,
&dev_attr_devspec.attr,
&dev_attr_modalias.attr,
NULL,
};
ATTRIBUTE_GROUPS(vio_dev);
void vio_unregister_device(struct vio_dev *viodev)
{
device_unregister(&viodev->dev);
......@@ -1626,6 +1602,38 @@ static int vio_hotplug(const struct device *dev, struct kobj_uevent_env *env)
return 0;
}
#ifdef CONFIG_PPC_SMLPAR
static struct attribute *vio_cmo_dev_attrs[] = {
&dev_attr_name.attr,
&dev_attr_devspec.attr,
&dev_attr_modalias.attr,
&dev_attr_cmo_entitled.attr,
&dev_attr_cmo_allocated.attr,
&dev_attr_cmo_desired.attr,
&dev_attr_cmo_allocs_failed.attr,
NULL,
};
ATTRIBUTE_GROUPS(vio_cmo_dev);
struct bus_type vio_bus_type = {
.name = "vio",
.dev_groups = vio_cmo_dev_groups,
.bus_groups = vio_bus_groups,
.uevent = vio_hotplug,
.match = vio_bus_match,
.probe = vio_bus_probe,
.remove = vio_bus_remove,
.shutdown = vio_bus_shutdown,
};
#else /* CONFIG_PPC_SMLPAR */
static struct attribute *vio_dev_attrs[] = {
&dev_attr_name.attr,
&dev_attr_devspec.attr,
&dev_attr_modalias.attr,
NULL,
};
ATTRIBUTE_GROUPS(vio_dev);
struct bus_type vio_bus_type = {
.name = "vio",
.dev_groups = vio_dev_groups,
......@@ -1635,6 +1643,7 @@ struct bus_type vio_bus_type = {
.remove = vio_bus_remove,
.shutdown = vio_bus_shutdown,
};
#endif /* CONFIG_PPC_SMLPAR */
/**
* vio_get_attribute: - get attribute for virtual device
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment