Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 128011
b: refs/heads/master
c: 7246c31
h: refs/heads/master
i:
  128009: 2447c5b
  128007: 18f77c6
v: v3
  • Loading branch information
Helge Deller authored and Kyle McMartin committed Jan 5, 2009
1 parent f8d1b11 commit b029d3c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5fbf6635a951a75870be9874580c55da538fb025
refs/heads/master: 7246c31e45021bc68688c4a8fd2bbb70b485d1ef
40 changes: 34 additions & 6 deletions trunk/arch/parisc/kernel/drivers.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,38 @@ static int parisc_generic_match(struct device *dev, struct device_driver *drv)
return match_device(to_parisc_driver(drv), to_parisc_device(dev));
}

static ssize_t make_modalias(struct device *dev, char *buf)
{
const struct parisc_device *padev = to_parisc_device(dev);
const struct parisc_device_id *id = &padev->id;

return sprintf(buf, "parisc:t%02Xhv%04Xrev%02Xsv%08X\n",
(u8)id->hw_type, (u16)id->hversion, (u8)id->hversion_rev,
(u32)id->sversion);
}

static int parisc_uevent(struct device *dev, struct kobj_uevent_env *env)
{
const struct parisc_device *padev;
char modalias[40];

if (!dev)
return -ENODEV;

padev = to_parisc_device(dev);
if (!padev)
return -ENODEV;

if (add_uevent_var(env, "PARISC_NAME=%s", padev->name))
return -ENOMEM;

make_modalias(dev, modalias);
if (add_uevent_var(env, "MODALIAS=%s", modalias))
return -ENOMEM;

return 0;
}

#define pa_dev_attr(name, field, format_string) \
static ssize_t name##_show(struct device *dev, struct device_attribute *attr, char *buf) \
{ \
Expand All @@ -566,12 +598,7 @@ pa_dev_attr_id(sversion, "0x%05x\n");

static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf)
{
struct parisc_device *padev = to_parisc_device(dev);
struct parisc_device_id *id = &padev->id;

return sprintf(buf, "parisc:t%02Xhv%04Xrev%02Xsv%08X\n",
(u8)id->hw_type, (u16)id->hversion, (u8)id->hversion_rev,
(u32)id->sversion);
return make_modalias(dev, buf);
}

static struct device_attribute parisc_device_attrs[] = {
Expand All @@ -587,6 +614,7 @@ static struct device_attribute parisc_device_attrs[] = {
struct bus_type parisc_bus_type = {
.name = "parisc",
.match = parisc_generic_match,
.uevent = parisc_uevent,
.dev_attrs = parisc_device_attrs,
.probe = parisc_driver_probe,
.remove = parisc_driver_remove,
Expand Down

0 comments on commit b029d3c

Please sign in to comment.