diff mbox

[0/4] Fedora kernel patch review

Message ID 20100205135354.GI12001@hansolo.jdub.homelinux.org (mailing list archive)
State Accepted, archived
Delegated to: Benjamin Herrenschmidt
Headers show

Commit Message

Josh Boyer Feb. 5, 2010, 1:53 p.m. UTC
Provide a modalias entry for VIO devices in sysfs.  I believe
this was another initrd generation bugfix for anaconda.

---

Comments

Josh Boyer Feb. 5, 2010, 1:59 p.m. UTC | #1
On Fri, Feb 05, 2010 at 08:53:54AM -0500, Josh Boyer wrote:
>Provide a modalias entry for VIO devices in sysfs.  I believe
>this was another initrd generation bugfix for anaconda.

Bah, subject on this should have been [PATCH 3/4] Provide VIO modalias
David Woodhouse Feb. 23, 2010, 12:50 p.m. UTC | #2
On Fri, 2010-02-05 at 08:53 -0500, Josh Boyer wrote:
> Provide a modalias entry for VIO devices in sysfs.  I believe
> this was another initrd generation bugfix for anaconda.
> 
> ---

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

Not entirely sure why this didn't get upstream when I first did it;
maybe I just posted it once and then forgot about it?

> diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
> index f988672..12a0851 100644
> --- a/arch/powerpc/kernel/vio.c
> +++ b/arch/powerpc/kernel/vio.c
> @@ -294,9 +294,27 @@ static ssize_t devspec_show(struct device *dev,
>  	return sprintf(buf, "%s\n", of_node ? of_node->full_name : "none");
>  }
>  
> +static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
> +			     char *buf)
> +{
> +	const struct vio_dev *vio_dev = to_vio_dev(dev);
> +	struct device_node *dn;
> +	const char *cp;
> +
> +	dn = dev->archdata.of_node;
> +	if (!dn)
> +		return -ENODEV;
> +	cp = of_get_property(dn, "compatible", NULL);
> +	if (!cp)
> +		return -ENODEV;
> +
> +	return sprintf(buf, "vio:T%sS%s\n", vio_dev->type, cp);
> +}
> +
>  static struct device_attribute vio_dev_attrs[] = {
>  	__ATTR_RO(name),
>  	__ATTR_RO(devspec),
> +	__ATTR_RO(modalias),
>  	__ATTR_NULL
>  };
> 
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
Brian King Feb. 24, 2010, 12:05 a.m. UTC | #3
On 02/23/2010 06:50 AM, David Woodhouse wrote:
>> +static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
>> +			     char *buf)
>> +{
>> +	const struct vio_dev *vio_dev = to_vio_dev(dev);
>> +	struct device_node *dn;
>> +	const char *cp;
>> +
>> +	dn = dev->archdata.of_node;
>> +	if (!dn)
>> +		return -ENODEV;
>> +	cp = of_get_property(dn, "compatible", NULL);
>> +	if (!cp)
>> +		return -ENODEV;
>> +
>> +	return sprintf(buf, "vio:T%sS%s\n", vio_dev->type, cp);
>> +}
>> +
>>  static struct device_attribute vio_dev_attrs[] = {
>>  	__ATTR_RO(name),
>>  	__ATTR_RO(devspec),
>> +	__ATTR_RO(modalias),
>>  	__ATTR_NULL
>>  };

You'll want to add this to vio_cmo_dev_attrs as well, as that is the
device attribute array that gets used when active memory sharing is enabled.

Thanks,

Brian
diff mbox

Patch

diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index f988672..12a0851 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -294,9 +294,27 @@  static ssize_t devspec_show(struct device *dev,
 	return sprintf(buf, "%s\n", of_node ? of_node->full_name : "none");
 }
 
+static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
+			     char *buf)
+{
+	const struct vio_dev *vio_dev = to_vio_dev(dev);
+	struct device_node *dn;
+	const char *cp;
+
+	dn = dev->archdata.of_node;
+	if (!dn)
+		return -ENODEV;
+	cp = of_get_property(dn, "compatible", NULL);
+	if (!cp)
+		return -ENODEV;
+
+	return sprintf(buf, "vio:T%sS%s\n", vio_dev->type, cp);
+}
+
 static struct device_attribute vio_dev_attrs[] = {
 	__ATTR_RO(name),
 	__ATTR_RO(devspec),
+	__ATTR_RO(modalias),
 	__ATTR_NULL
 };