提交 fa3e967f 编写于 作者: L Lukas Wunner 提交者: Daniel Vetter

vga_switcheroo: Use enum vga_switcheroo_client_id instead of int

Signed-off-by: NLukas Wunner <lukas@wunner.de>
Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
上级 21c5ba8c
...@@ -102,7 +102,7 @@ struct vga_switcheroo_client { ...@@ -102,7 +102,7 @@ struct vga_switcheroo_client {
struct fb_info *fb_info; struct fb_info *fb_info;
enum vga_switcheroo_state pwr_state; enum vga_switcheroo_state pwr_state;
const struct vga_switcheroo_client_ops *ops; const struct vga_switcheroo_client_ops *ops;
int id; enum vga_switcheroo_client_id id;
bool active; bool active;
bool driver_power_control; bool driver_power_control;
struct list_head list; struct list_head list;
...@@ -233,7 +233,8 @@ EXPORT_SYMBOL(vga_switcheroo_unregister_handler); ...@@ -233,7 +233,8 @@ EXPORT_SYMBOL(vga_switcheroo_unregister_handler);
static int register_client(struct pci_dev *pdev, static int register_client(struct pci_dev *pdev,
const struct vga_switcheroo_client_ops *ops, const struct vga_switcheroo_client_ops *ops,
int id, bool active, bool driver_power_control) enum vga_switcheroo_client_id id, bool active,
bool driver_power_control)
{ {
struct vga_switcheroo_client *client; struct vga_switcheroo_client *client;
...@@ -288,7 +289,7 @@ EXPORT_SYMBOL(vga_switcheroo_register_client); ...@@ -288,7 +289,7 @@ EXPORT_SYMBOL(vga_switcheroo_register_client);
* vga_switcheroo_register_audio_client - register audio client * vga_switcheroo_register_audio_client - register audio client
* @pdev: client pci device * @pdev: client pci device
* @ops: client callbacks * @ops: client callbacks
* @id: client identifier, see enum vga_switcheroo_client_id * @id: client identifier
* *
* Register audio client (audio device on a GPU). The power state of the * Register audio client (audio device on a GPU). The power state of the
* client is assumed to be ON. * client is assumed to be ON.
...@@ -297,7 +298,7 @@ EXPORT_SYMBOL(vga_switcheroo_register_client); ...@@ -297,7 +298,7 @@ EXPORT_SYMBOL(vga_switcheroo_register_client);
*/ */
int vga_switcheroo_register_audio_client(struct pci_dev *pdev, int vga_switcheroo_register_audio_client(struct pci_dev *pdev,
const struct vga_switcheroo_client_ops *ops, const struct vga_switcheroo_client_ops *ops,
int id) enum vga_switcheroo_client_id id)
{ {
return register_client(pdev, ops, id | ID_BIT_AUDIO, false, false); return register_client(pdev, ops, id | ID_BIT_AUDIO, false, false);
} }
...@@ -315,7 +316,8 @@ find_client_from_pci(struct list_head *head, struct pci_dev *pdev) ...@@ -315,7 +316,8 @@ find_client_from_pci(struct list_head *head, struct pci_dev *pdev)
} }
static struct vga_switcheroo_client * static struct vga_switcheroo_client *
find_client_from_id(struct list_head *head, int client_id) find_client_from_id(struct list_head *head,
enum vga_switcheroo_client_id client_id)
{ {
struct vga_switcheroo_client *client; struct vga_switcheroo_client *client;
...@@ -497,7 +499,8 @@ static int vga_switchoff(struct vga_switcheroo_client *client) ...@@ -497,7 +499,8 @@ static int vga_switchoff(struct vga_switcheroo_client *client)
return 0; return 0;
} }
static void set_audio_state(int id, enum vga_switcheroo_state state) static void set_audio_state(enum vga_switcheroo_client_id id,
enum vga_switcheroo_state state)
{ {
struct vga_switcheroo_client *client; struct vga_switcheroo_client *client;
...@@ -584,7 +587,7 @@ vga_switcheroo_debugfs_write(struct file *filp, const char __user *ubuf, ...@@ -584,7 +587,7 @@ vga_switcheroo_debugfs_write(struct file *filp, const char __user *ubuf,
int ret; int ret;
bool delay = false, can_switch; bool delay = false, can_switch;
bool just_mux = false; bool just_mux = false;
int client_id = VGA_SWITCHEROO_UNKNOWN_ID; enum vga_switcheroo_client_id client_id = VGA_SWITCHEROO_UNKNOWN_ID;
struct vga_switcheroo_client *client = NULL; struct vga_switcheroo_client *client = NULL;
if (cnt > 63) if (cnt > 63)
......
...@@ -100,7 +100,7 @@ struct vga_switcheroo_handler { ...@@ -100,7 +100,7 @@ struct vga_switcheroo_handler {
int (*switchto)(enum vga_switcheroo_client_id id); int (*switchto)(enum vga_switcheroo_client_id id);
int (*power_state)(enum vga_switcheroo_client_id id, int (*power_state)(enum vga_switcheroo_client_id id,
enum vga_switcheroo_state state); enum vga_switcheroo_state state);
int (*get_client_id)(struct pci_dev *pdev); enum vga_switcheroo_client_id (*get_client_id)(struct pci_dev *pdev);
}; };
/** /**
...@@ -132,7 +132,7 @@ int vga_switcheroo_register_client(struct pci_dev *dev, ...@@ -132,7 +132,7 @@ int vga_switcheroo_register_client(struct pci_dev *dev,
bool driver_power_control); bool driver_power_control);
int vga_switcheroo_register_audio_client(struct pci_dev *pdev, int vga_switcheroo_register_audio_client(struct pci_dev *pdev,
const struct vga_switcheroo_client_ops *ops, const struct vga_switcheroo_client_ops *ops,
int id); enum vga_switcheroo_client_id id);
void vga_switcheroo_client_fb_set(struct pci_dev *dev, void vga_switcheroo_client_fb_set(struct pci_dev *dev,
struct fb_info *info); struct fb_info *info);
...@@ -158,7 +158,7 @@ static inline void vga_switcheroo_client_fb_set(struct pci_dev *dev, struct fb_i ...@@ -158,7 +158,7 @@ static inline void vga_switcheroo_client_fb_set(struct pci_dev *dev, struct fb_i
static inline int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler) { return 0; } static inline int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler) { return 0; }
static inline int vga_switcheroo_register_audio_client(struct pci_dev *pdev, static inline int vga_switcheroo_register_audio_client(struct pci_dev *pdev,
const struct vga_switcheroo_client_ops *ops, const struct vga_switcheroo_client_ops *ops,
int id) { return 0; } enum vga_switcheroo_client_id id) { return 0; }
static inline void vga_switcheroo_unregister_handler(void) {} static inline void vga_switcheroo_unregister_handler(void) {}
static inline int vga_switcheroo_process_delayed_switch(void) { return 0; } static inline int vga_switcheroo_process_delayed_switch(void) { return 0; }
static inline enum vga_switcheroo_state vga_switcheroo_get_client_state(struct pci_dev *dev) { return VGA_SWITCHEROO_ON; } static inline enum vga_switcheroo_state vga_switcheroo_get_client_state(struct pci_dev *dev) { return VGA_SWITCHEROO_ON; }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册