Commit 9db8b2dd authored by Matthew Wilcox's avatar Matthew Wilcox Committed by Linus Torvalds

[PATCH] Convert from a struct dev to a firmware hwpath

PA-RISC firmware needs a hwpath which can be constructed from a pci_dev
or a parisc_device.  Previously we've known what type of device we had,
but when using sysfs we have to figure it out.
Signed-off-by: default avatarThibaut VARENE <varenet@parisc-linux.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 95c15e30
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* Copyright (c) 2001 Matthew Wilcox for Hewlett Packard * Copyright (c) 2001 Matthew Wilcox for Hewlett Packard
* Copyright (c) 2001 Helge Deller <deller@gmx.de> * Copyright (c) 2001 Helge Deller <deller@gmx.de>
* Copyright (c) 2001,2002 Ryan Bradetich * Copyright (c) 2001,2002 Ryan Bradetich
* Copyright (c) 2004 Thibaut VARENE <varenet@parisc-linux.org> * Copyright (c) 2004-2005 Thibaut VARENE <varenet@parisc-linux.org>
* *
* The file handles registering devices and drivers, then matching them. * The file handles registering devices and drivers, then matching them.
* It's the closest we get to a dating agency. * It's the closest we get to a dating agency.
...@@ -611,6 +611,24 @@ struct device *hwpath_to_device(struct hardware_path *modpath) ...@@ -611,6 +611,24 @@ struct device *hwpath_to_device(struct hardware_path *modpath)
} }
EXPORT_SYMBOL(hwpath_to_device); EXPORT_SYMBOL(hwpath_to_device);
/**
* device_to_hwpath - Populates the hwpath corresponding to the given device.
* @param dev the target device
* @param path pointer to a previously allocated hwpath struct to be filled in
*/
void device_to_hwpath(struct device *dev, struct hardware_path *path)
{
struct parisc_device *padev;
if (dev->bus == &parisc_bus_type) {
padev = to_parisc_device(dev);
get_node_path(dev->parent, path);
path->mod = padev->hw_path;
} else if (is_pci_dev(dev)) {
get_node_path(dev, path);
}
}
EXPORT_SYMBOL(device_to_hwpath);
#define BC_PORT_MASK 0x8 #define BC_PORT_MASK 0x8
#define BC_LOWER_PORT 0x8 #define BC_LOWER_PORT 0x8
......
...@@ -122,6 +122,7 @@ extern char *print_pci_hwpath(struct pci_dev *dev, char *path); ...@@ -122,6 +122,7 @@ extern char *print_pci_hwpath(struct pci_dev *dev, char *path);
extern void get_pci_node_path(struct pci_dev *dev, struct hardware_path *path); extern void get_pci_node_path(struct pci_dev *dev, struct hardware_path *path);
extern void init_parisc_bus(void); extern void init_parisc_bus(void);
extern struct device *hwpath_to_device(struct hardware_path *modpath); extern struct device *hwpath_to_device(struct hardware_path *modpath);
extern void device_to_hwpath(struct device *dev, struct hardware_path *path);
/* inventory.c: */ /* inventory.c: */
......
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