From 24aadc809f270857743e62d0882865fb3ba195d9 Mon Sep 17 00:00:00 2001 From: Tomas Winkler Date: Mon, 25 Jun 2012 23:46:27 +0300 Subject: mei: don't query HCSR for host buffer depth 1. We record host (write) buffer depth during reset so we don't need to query HCSR register later on. The host buffer depth doesn't change after the reset 2. Use mei_hbuf_max_data function to compute payload size in bytes Signed-off-by: Tomas Winkler Signed-off-by: Greg Kroah-Hartman --- drivers/misc/mei/main.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'drivers/misc/mei/main.c') diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c index c70333228337..aaf2683ea154 100644 --- a/drivers/misc/mei/main.c +++ b/drivers/misc/mei/main.c @@ -714,13 +714,8 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf, if (rets && dev->mei_host_buffer_is_empty) { rets = 0; dev->mei_host_buffer_is_empty = false; - if (length > ((((dev->host_hw_state & H_CBD) >> 24) * - sizeof(u32)) - sizeof(struct mei_msg_hdr))) { - - mei_hdr.length = - (((dev->host_hw_state & H_CBD) >> 24) * - sizeof(u32)) - - sizeof(struct mei_msg_hdr); + if (length > mei_hbuf_max_data(dev)) { + mei_hdr.length = mei_hbuf_max_data(dev); mei_hdr.msg_complete = 0; } else { mei_hdr.length = length; -- cgit v1.2.3 From 6078188e2ba1d61a2119ddb2289e88c2c2a015ab Mon Sep 17 00:00:00 2001 From: Tomas Winkler Date: Thu, 19 Jul 2012 09:45:32 +0300 Subject: mei: use module_pci_driver use module_pci_driver() macro to wrap standard pci module registration into a single line Signed-off-by: Tomas Winkler Signed-off-by: Greg Kroah-Hartman --- drivers/misc/mei/main.c | 39 +-------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) (limited to 'drivers/misc/mei/main.c') diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c index 0d98c2ee6fe3..092330208869 100644 --- a/drivers/misc/mei/main.c +++ b/drivers/misc/mei/main.c @@ -1182,44 +1182,7 @@ static struct pci_driver mei_driver = { .driver.pm = MEI_PM_OPS, }; -/** - * mei_init_module - Driver Registration Routine - * - * mei_init_module is the first routine called when the driver is - * loaded. All it does is to register with the PCI subsystem. - * - * returns 0 on success, <0 on failure. - */ -static int __init mei_init_module(void) -{ - int ret; - - pr_debug("loading.\n"); - /* init pci module */ - ret = pci_register_driver(&mei_driver); - if (ret < 0) - pr_err("error registering driver.\n"); - - return ret; -} - -module_init(mei_init_module); - -/** - * mei_exit_module - Driver Exit Cleanup Routine - * - * mei_exit_module is called just before the driver is removed - * from memory. - */ -static void __exit mei_exit_module(void) -{ - pci_unregister_driver(&mei_driver); - - pr_debug("unloaded successfully.\n"); -} - -module_exit(mei_exit_module); - +module_pci_driver(mei_driver); MODULE_AUTHOR("Intel Corporation"); MODULE_DESCRIPTION("Intel(R) Management Engine Interface"); -- cgit v1.2.3