提交 620e112c 编写于 作者: T Thomas Renninger 提交者: Len Brown

ACPI/PNP: A HID value of an object never changes -> make it const

Signed-off-by: NThomas Renninger <trenn@suse.de>
Signed-off-by: NLen Brown <len.brown@intel.com>
上级 2b2ae7c7
...@@ -338,7 +338,8 @@ static int acpi_button_add(struct acpi_device *device) ...@@ -338,7 +338,8 @@ static int acpi_button_add(struct acpi_device *device)
{ {
struct acpi_button *button; struct acpi_button *button;
struct input_dev *input; struct input_dev *input;
char *hid, *name, *class; const char *hid = acpi_device_hid(device);
char *name, *class;
int error; int error;
button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL); button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL);
...@@ -353,7 +354,6 @@ static int acpi_button_add(struct acpi_device *device) ...@@ -353,7 +354,6 @@ static int acpi_button_add(struct acpi_device *device)
goto err_free_button; goto err_free_button;
} }
hid = acpi_device_hid(device);
name = acpi_device_name(device); name = acpi_device_name(device);
class = acpi_device_class(device); class = acpi_device_class(device);
......
...@@ -26,8 +26,7 @@ extern struct acpi_device *acpi_root; ...@@ -26,8 +26,7 @@ extern struct acpi_device *acpi_root;
#define ACPI_IS_ROOT_DEVICE(device) (!(device)->parent) #define ACPI_IS_ROOT_DEVICE(device) (!(device)->parent)
/* Should be const */ static const char *dummy_hid = "device";
static char* dummy_hid = "device";
static LIST_HEAD(acpi_device_list); static LIST_HEAD(acpi_device_list);
static LIST_HEAD(acpi_bus_id_list); static LIST_HEAD(acpi_bus_id_list);
...@@ -1021,7 +1020,7 @@ static int acpi_dock_match(struct acpi_device *device) ...@@ -1021,7 +1020,7 @@ static int acpi_dock_match(struct acpi_device *device)
return acpi_get_handle(device->handle, "_DCK", &tmp); return acpi_get_handle(device->handle, "_DCK", &tmp);
} }
char *acpi_device_hid(struct acpi_device *device) const char *acpi_device_hid(struct acpi_device *device)
{ {
struct acpi_hardware_id *hid; struct acpi_hardware_id *hid;
......
...@@ -12,11 +12,12 @@ void pnp_unregister_protocol(struct pnp_protocol *protocol); ...@@ -12,11 +12,12 @@ void pnp_unregister_protocol(struct pnp_protocol *protocol);
#define PNP_EISA_ID_MASK 0x7fffffff #define PNP_EISA_ID_MASK 0x7fffffff
void pnp_eisa_id_to_string(u32 id, char *str); void pnp_eisa_id_to_string(u32 id, char *str);
struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *, int id, char *pnpid); struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *, int id,
const char *pnpid);
struct pnp_card *pnp_alloc_card(struct pnp_protocol *, int id, char *pnpid); struct pnp_card *pnp_alloc_card(struct pnp_protocol *, int id, char *pnpid);
int pnp_add_device(struct pnp_dev *dev); int pnp_add_device(struct pnp_dev *dev);
struct pnp_id *pnp_add_id(struct pnp_dev *dev, char *id); struct pnp_id *pnp_add_id(struct pnp_dev *dev, const char *id);
int pnp_add_card(struct pnp_card *card); int pnp_add_card(struct pnp_card *card);
void pnp_remove_card(struct pnp_card *card); void pnp_remove_card(struct pnp_card *card);
......
...@@ -124,7 +124,8 @@ static void pnp_release_device(struct device *dmdev) ...@@ -124,7 +124,8 @@ static void pnp_release_device(struct device *dmdev)
kfree(dev); kfree(dev);
} }
struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *protocol, int id, char *pnpid) struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *protocol, int id,
const char *pnpid)
{ {
struct pnp_dev *dev; struct pnp_dev *dev;
struct pnp_id *dev_id; struct pnp_id *dev_id;
......
...@@ -236,7 +236,7 @@ void pnp_unregister_driver(struct pnp_driver *drv) ...@@ -236,7 +236,7 @@ void pnp_unregister_driver(struct pnp_driver *drv)
* @dev: pointer to the desired device * @dev: pointer to the desired device
* @id: pointer to an EISA id string * @id: pointer to an EISA id string
*/ */
struct pnp_id *pnp_add_id(struct pnp_dev *dev, char *id) struct pnp_id *pnp_add_id(struct pnp_dev *dev, const char *id)
{ {
struct pnp_id *dev_id, *ptr; struct pnp_id *dev_id, *ptr;
......
...@@ -59,7 +59,7 @@ static inline int __init is_exclusive_device(struct acpi_device *dev) ...@@ -59,7 +59,7 @@ static inline int __init is_exclusive_device(struct acpi_device *dev)
#define TEST_ALPHA(c) \ #define TEST_ALPHA(c) \
if (!('@' <= (c) || (c) <= 'Z')) \ if (!('@' <= (c) || (c) <= 'Z')) \
return 0 return 0
static int __init ispnpidacpi(char *id) static int __init ispnpidacpi(const char *id)
{ {
TEST_ALPHA(id[0]); TEST_ALPHA(id[0]);
TEST_ALPHA(id[1]); TEST_ALPHA(id[1]);
......
...@@ -184,7 +184,7 @@ struct acpi_device_pnp { ...@@ -184,7 +184,7 @@ struct acpi_device_pnp {
#define acpi_device_bid(d) ((d)->pnp.bus_id) #define acpi_device_bid(d) ((d)->pnp.bus_id)
#define acpi_device_adr(d) ((d)->pnp.bus_address) #define acpi_device_adr(d) ((d)->pnp.bus_address)
char *acpi_device_hid(struct acpi_device *device); const char *acpi_device_hid(struct acpi_device *device);
#define acpi_device_name(d) ((d)->pnp.device_name) #define acpi_device_name(d) ((d)->pnp.device_name)
#define acpi_device_class(d) ((d)->pnp.device_class) #define acpi_device_class(d) ((d)->pnp.device_class)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册