platform/x86: dell_rbu: Unify format of the printed messages
Here we do: - unify all message to have module name prefix via pr_fmt() - replace printk(LEVEL ... ) with pr_level(...) - drop __func__ from messages - join string literals to be on one line - drop trailing periods and spaces Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
This commit is contained in:
@@ -26,6 +26,9 @@
|
|||||||
*
|
*
|
||||||
* See Documentation/admin-guide/dell_rbu.rst for more info.
|
* See Documentation/admin-guide/dell_rbu.rst for more info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
@@ -61,13 +64,11 @@ static struct _rbu_data {
|
|||||||
|
|
||||||
static char image_type[MAX_IMAGE_LENGTH + 1] = "mono";
|
static char image_type[MAX_IMAGE_LENGTH + 1] = "mono";
|
||||||
module_param_string(image_type, image_type, sizeof (image_type), 0);
|
module_param_string(image_type, image_type, sizeof (image_type), 0);
|
||||||
MODULE_PARM_DESC(image_type,
|
MODULE_PARM_DESC(image_type, "BIOS image type. choose- mono or packet or init");
|
||||||
"BIOS image type. choose- mono or packet or init");
|
|
||||||
|
|
||||||
static unsigned long allocation_floor = 0x100000;
|
static unsigned long allocation_floor = 0x100000;
|
||||||
module_param(allocation_floor, ulong, 0644);
|
module_param(allocation_floor, ulong, 0644);
|
||||||
MODULE_PARM_DESC(allocation_floor,
|
MODULE_PARM_DESC(allocation_floor, "Minimum address for allocations when using Packet mode");
|
||||||
"Minimum address for allocations when using Packet mode");
|
|
||||||
|
|
||||||
struct packet_data {
|
struct packet_data {
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
@@ -100,10 +101,10 @@ static int create_packet(void *data, size_t length)
|
|||||||
void *packet_data_temp_buf = NULL;
|
void *packet_data_temp_buf = NULL;
|
||||||
unsigned int idx = 0;
|
unsigned int idx = 0;
|
||||||
|
|
||||||
pr_debug("create_packet: entry \n");
|
pr_debug("entry\n");
|
||||||
|
|
||||||
if (!rbu_data.packetsize) {
|
if (!rbu_data.packetsize) {
|
||||||
pr_debug("create_packet: packetsize not specified\n");
|
pr_debug("packetsize not specified\n");
|
||||||
retval = -EINVAL;
|
retval = -EINVAL;
|
||||||
goto out_noalloc;
|
goto out_noalloc;
|
||||||
}
|
}
|
||||||
@@ -113,9 +114,7 @@ static int create_packet(void *data, size_t length)
|
|||||||
newpacket = kzalloc(sizeof (struct packet_data), GFP_KERNEL);
|
newpacket = kzalloc(sizeof (struct packet_data), GFP_KERNEL);
|
||||||
|
|
||||||
if (!newpacket) {
|
if (!newpacket) {
|
||||||
printk(KERN_WARNING
|
pr_warn("failed to allocate new packet\n");
|
||||||
"dell_rbu:%s: failed to allocate new "
|
|
||||||
"packet\n", __func__);
|
|
||||||
retval = -ENOMEM;
|
retval = -ENOMEM;
|
||||||
spin_lock(&rbu_data.lock);
|
spin_lock(&rbu_data.lock);
|
||||||
goto out_noalloc;
|
goto out_noalloc;
|
||||||
@@ -139,10 +138,7 @@ static int create_packet(void *data, size_t length)
|
|||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
|
|
||||||
if (!invalid_addr_packet_array) {
|
if (!invalid_addr_packet_array) {
|
||||||
printk(KERN_WARNING
|
pr_warn("failed to allocate invalid_addr_packet_array\n");
|
||||||
"dell_rbu:%s: failed to allocate "
|
|
||||||
"invalid_addr_packet_array \n",
|
|
||||||
__func__);
|
|
||||||
retval = -ENOMEM;
|
retval = -ENOMEM;
|
||||||
spin_lock(&rbu_data.lock);
|
spin_lock(&rbu_data.lock);
|
||||||
goto out_alloc_packet;
|
goto out_alloc_packet;
|
||||||
@@ -152,9 +148,7 @@ static int create_packet(void *data, size_t length)
|
|||||||
packet_data_temp_buf = (unsigned char *)
|
packet_data_temp_buf = (unsigned char *)
|
||||||
__get_free_pages(GFP_KERNEL, ordernum);
|
__get_free_pages(GFP_KERNEL, ordernum);
|
||||||
if (!packet_data_temp_buf) {
|
if (!packet_data_temp_buf) {
|
||||||
printk(KERN_WARNING
|
pr_warn("failed to allocate new packet\n");
|
||||||
"dell_rbu:%s: failed to allocate new "
|
|
||||||
"packet\n", __func__);
|
|
||||||
retval = -ENOMEM;
|
retval = -ENOMEM;
|
||||||
spin_lock(&rbu_data.lock);
|
spin_lock(&rbu_data.lock);
|
||||||
goto out_alloc_packet_array;
|
goto out_alloc_packet_array;
|
||||||
@@ -162,7 +156,7 @@ static int create_packet(void *data, size_t length)
|
|||||||
|
|
||||||
if ((unsigned long)virt_to_phys(packet_data_temp_buf)
|
if ((unsigned long)virt_to_phys(packet_data_temp_buf)
|
||||||
< allocation_floor) {
|
< allocation_floor) {
|
||||||
pr_debug("packet 0x%lx below floor at 0x%lx.\n",
|
pr_debug("packet 0x%lx below floor at 0x%lx\n",
|
||||||
(unsigned long)virt_to_phys(
|
(unsigned long)virt_to_phys(
|
||||||
packet_data_temp_buf),
|
packet_data_temp_buf),
|
||||||
allocation_floor);
|
allocation_floor);
|
||||||
@@ -179,7 +173,7 @@ static int create_packet(void *data, size_t length)
|
|||||||
|
|
||||||
newpacket->data = packet_data_temp_buf;
|
newpacket->data = packet_data_temp_buf;
|
||||||
|
|
||||||
pr_debug("create_packet: newpacket at physical addr %lx\n",
|
pr_debug("newpacket at physical addr %lx\n",
|
||||||
(unsigned long)virt_to_phys(newpacket->data));
|
(unsigned long)virt_to_phys(newpacket->data));
|
||||||
|
|
||||||
/* packets may not have fixed size */
|
/* packets may not have fixed size */
|
||||||
@@ -193,12 +187,12 @@ static int create_packet(void *data, size_t length)
|
|||||||
|
|
||||||
memcpy(newpacket->data, data, length);
|
memcpy(newpacket->data, data, length);
|
||||||
|
|
||||||
pr_debug("create_packet: exit \n");
|
pr_debug("exit\n");
|
||||||
|
|
||||||
out_alloc_packet_array:
|
out_alloc_packet_array:
|
||||||
/* always free packet array */
|
/* always free packet array */
|
||||||
while (idx--) {
|
while (idx--) {
|
||||||
pr_debug("freeing unused packet below floor 0x%lx.\n",
|
pr_debug("freeing unused packet below floor 0x%lx\n",
|
||||||
(unsigned long)virt_to_phys(invalid_addr_packet_array[idx]));
|
(unsigned long)virt_to_phys(invalid_addr_packet_array[idx]));
|
||||||
free_pages((unsigned long)invalid_addr_packet_array[idx], ordernum);
|
free_pages((unsigned long)invalid_addr_packet_array[idx], ordernum);
|
||||||
}
|
}
|
||||||
@@ -220,10 +214,9 @@ static int packetize_data(const u8 *data, size_t length)
|
|||||||
int packet_length;
|
int packet_length;
|
||||||
u8 *temp;
|
u8 *temp;
|
||||||
u8 *end = (u8 *) data + length;
|
u8 *end = (u8 *) data + length;
|
||||||
pr_debug("packetize_data: data length %zd\n", length);
|
pr_debug("data length %zd\n", length);
|
||||||
if (!rbu_data.packetsize) {
|
if (!rbu_data.packetsize) {
|
||||||
printk(KERN_WARNING
|
pr_warn("packetsize not specified\n");
|
||||||
"dell_rbu: packetsize not specified\n");
|
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -392,8 +385,7 @@ static int img_update_realloc(unsigned long size)
|
|||||||
* check for corruption
|
* check for corruption
|
||||||
*/
|
*/
|
||||||
if ((size != 0) && (rbu_data.image_update_buffer == NULL)) {
|
if ((size != 0) && (rbu_data.image_update_buffer == NULL)) {
|
||||||
printk(KERN_ERR "dell_rbu:%s: corruption "
|
pr_err("corruption check failed\n");
|
||||||
"check failed\n", __func__);
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@@ -415,8 +407,7 @@ static int img_update_realloc(unsigned long size)
|
|||||||
(unsigned char *)__get_free_pages(GFP_DMA32, ordernum);
|
(unsigned char *)__get_free_pages(GFP_DMA32, ordernum);
|
||||||
spin_lock(&rbu_data.lock);
|
spin_lock(&rbu_data.lock);
|
||||||
if (!image_update_buffer) {
|
if (!image_update_buffer) {
|
||||||
pr_debug("Not enough memory for image update:"
|
pr_debug("Not enough memory for image update: size = %ld\n", size);
|
||||||
"size = %ld\n", size);
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,15 +431,14 @@ static ssize_t read_packet_data(char *buffer, loff_t pos, size_t count)
|
|||||||
|
|
||||||
/* check to see if we have something to return */
|
/* check to see if we have something to return */
|
||||||
if (rbu_data.num_packets == 0) {
|
if (rbu_data.num_packets == 0) {
|
||||||
pr_debug("read_packet_data: no packets written\n");
|
pr_debug("no packets written\n");
|
||||||
retval = -ENOMEM;
|
retval = -ENOMEM;
|
||||||
goto read_rbu_data_exit;
|
goto read_rbu_data_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pos > rbu_data.imagesize) {
|
if (pos > rbu_data.imagesize) {
|
||||||
retval = 0;
|
retval = 0;
|
||||||
printk(KERN_WARNING "dell_rbu:read_packet_data: "
|
pr_warn("data underrun\n");
|
||||||
"data underrun\n");
|
|
||||||
goto read_rbu_data_exit;
|
goto read_rbu_data_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -474,8 +464,7 @@ static ssize_t read_rbu_mono_data(char *buffer, loff_t pos, size_t count)
|
|||||||
/* check to see if we have something to return */
|
/* check to see if we have something to return */
|
||||||
if ((rbu_data.image_update_buffer == NULL) ||
|
if ((rbu_data.image_update_buffer == NULL) ||
|
||||||
(rbu_data.bios_image_size == 0)) {
|
(rbu_data.bios_image_size == 0)) {
|
||||||
pr_debug("read_rbu_data_mono: image_update_buffer %p ,"
|
pr_debug("image_update_buffer %p, bios_image_size %lu\n",
|
||||||
"bios_image_size %lu\n",
|
|
||||||
rbu_data.image_update_buffer,
|
rbu_data.image_update_buffer,
|
||||||
rbu_data.bios_image_size);
|
rbu_data.bios_image_size);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@@ -498,7 +487,7 @@ static ssize_t data_read(struct file *filp, struct kobject *kobj,
|
|||||||
else if (!strcmp(image_type, "packet"))
|
else if (!strcmp(image_type, "packet"))
|
||||||
ret_count = read_packet_data(buffer, pos, count);
|
ret_count = read_packet_data(buffer, pos, count);
|
||||||
else
|
else
|
||||||
pr_debug("read_rbu_data: invalid image type specified\n");
|
pr_debug("invalid image type specified\n");
|
||||||
|
|
||||||
spin_unlock(&rbu_data.lock);
|
spin_unlock(&rbu_data.lock);
|
||||||
return ret_count;
|
return ret_count;
|
||||||
@@ -534,7 +523,7 @@ static void callbackfn_rbu(const struct firmware *fw, void *context)
|
|||||||
*/
|
*/
|
||||||
packet_empty_list();
|
packet_empty_list();
|
||||||
} else
|
} else
|
||||||
pr_debug("invalid image type specified.\n");
|
pr_debug("invalid image type specified\n");
|
||||||
spin_unlock(&rbu_data.lock);
|
spin_unlock(&rbu_data.lock);
|
||||||
out:
|
out:
|
||||||
release_firmware(fw);
|
release_firmware(fw);
|
||||||
@@ -588,9 +577,7 @@ static ssize_t image_type_write(struct file *filp, struct kobject *kobj,
|
|||||||
&rbu_device->dev, GFP_KERNEL, &context,
|
&rbu_device->dev, GFP_KERNEL, &context,
|
||||||
callbackfn_rbu);
|
callbackfn_rbu);
|
||||||
if (req_firm_rc) {
|
if (req_firm_rc) {
|
||||||
printk(KERN_ERR
|
pr_err("request_firmware_nowait failed %d\n", rc);
|
||||||
"dell_rbu:%s request_firmware_nowait"
|
|
||||||
" failed %d\n", __func__, rc);
|
|
||||||
rc = -EIO;
|
rc = -EIO;
|
||||||
} else
|
} else
|
||||||
rbu_data.entry_created = 1;
|
rbu_data.entry_created = 1;
|
||||||
@@ -598,7 +585,7 @@ static ssize_t image_type_write(struct file *filp, struct kobject *kobj,
|
|||||||
spin_lock(&rbu_data.lock);
|
spin_lock(&rbu_data.lock);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
printk(KERN_WARNING "dell_rbu: image_type is invalid\n");
|
pr_warn("image_type is invalid\n");
|
||||||
spin_unlock(&rbu_data.lock);
|
spin_unlock(&rbu_data.lock);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
@@ -660,9 +647,7 @@ static int __init dcdrbu_init(void)
|
|||||||
init_packet_head();
|
init_packet_head();
|
||||||
rbu_device = platform_device_register_simple("dell_rbu", -1, NULL, 0);
|
rbu_device = platform_device_register_simple("dell_rbu", -1, NULL, 0);
|
||||||
if (IS_ERR(rbu_device)) {
|
if (IS_ERR(rbu_device)) {
|
||||||
printk(KERN_ERR
|
pr_err("platform_device_register_simple failed\n");
|
||||||
"dell_rbu:%s:platform_device_register_simple "
|
|
||||||
"failed\n", __func__);
|
|
||||||
return PTR_ERR(rbu_device);
|
return PTR_ERR(rbu_device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user