mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-04-13 10:07:30 +07:00
firmware: clean up samples for coding style issues
This fixes up a number of coding style issues in the firmware sample files. Yeah, it still doesn't build properly yet, that's next... Cc: Randy Dunlap <randy.dunlap@oracle.com> Cc: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
d289bf7bdd
commit
4b65fc8cfb
@ -12,8 +12,7 @@
|
|||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
#include <linux/string.h>
|
#include <linux/string.h>
|
||||||
|
#include <linux/firmware.h>
|
||||||
#include "linux/firmware.h"
|
|
||||||
|
|
||||||
static struct device ghost_device = {
|
static struct device ghost_device = {
|
||||||
.bus_id = "ghost0",
|
.bus_id = "ghost0",
|
||||||
@ -32,10 +31,13 @@ static void sample_probe_default(void)
|
|||||||
{
|
{
|
||||||
/* uses the default method to get the firmware */
|
/* uses the default method to get the firmware */
|
||||||
const struct firmware *fw_entry;
|
const struct firmware *fw_entry;
|
||||||
printk(KERN_INFO "firmware_sample_driver: a ghost device got inserted :)\n");
|
int retval;
|
||||||
|
|
||||||
if(request_firmware(&fw_entry, "sample_driver_fw", &ghost_device)!=0)
|
printk(KERN_INFO "firmware_sample_driver: "
|
||||||
{
|
"a ghost device got inserted :)\n");
|
||||||
|
|
||||||
|
retval = request_firmware(&fw_entry, "sample_driver_fw", &ghost_device);
|
||||||
|
if (retval) {
|
||||||
printk(KERN_ERR
|
printk(KERN_ERR
|
||||||
"firmware_sample_driver: Firmware not available\n");
|
"firmware_sample_driver: Firmware not available\n");
|
||||||
return;
|
return;
|
||||||
@ -47,17 +49,20 @@ static void sample_probe_default(void)
|
|||||||
|
|
||||||
/* finish setting up the device */
|
/* finish setting up the device */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sample_probe_specific(void)
|
static void sample_probe_specific(void)
|
||||||
{
|
{
|
||||||
|
int retval;
|
||||||
/* Uses some specific hotplug support to get the firmware from
|
/* Uses some specific hotplug support to get the firmware from
|
||||||
* userspace directly into the hardware, or via some sysfs file */
|
* userspace directly into the hardware, or via some sysfs file */
|
||||||
|
|
||||||
/* NOTE: This currently doesn't work */
|
/* NOTE: This currently doesn't work */
|
||||||
|
|
||||||
printk(KERN_INFO "firmware_sample_driver: a ghost device got inserted :)\n");
|
printk(KERN_INFO "firmware_sample_driver: "
|
||||||
|
"a ghost device got inserted :)\n");
|
||||||
|
|
||||||
if(request_firmware(NULL, "sample_driver_fw", &ghost_device)!=0)
|
retval = request_firmware(NULL, "sample_driver_fw", &ghost_device);
|
||||||
{
|
if (retval) {
|
||||||
printk(KERN_ERR
|
printk(KERN_ERR
|
||||||
"firmware_sample_driver: Firmware load failed\n");
|
"firmware_sample_driver: Firmware load failed\n");
|
||||||
return;
|
return;
|
||||||
@ -80,6 +85,7 @@ static void sample_probe_async_cont(const struct firmware *fw, void *context)
|
|||||||
(char *)context);
|
(char *)context);
|
||||||
sample_firmware_load(fw->data, fw->size);
|
sample_firmware_load(fw->data, fw->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sample_probe_async(void)
|
static void sample_probe_async(void)
|
||||||
{
|
{
|
||||||
/* Let's say that I can't sleep */
|
/* Let's say that I can't sleep */
|
||||||
@ -88,12 +94,10 @@ static void sample_probe_async(void)
|
|||||||
"sample_driver_fw", &ghost_device,
|
"sample_driver_fw", &ghost_device,
|
||||||
"my device pointer",
|
"my device pointer",
|
||||||
sample_probe_async_cont);
|
sample_probe_async_cont);
|
||||||
if(error){
|
if (error)
|
||||||
printk(KERN_ERR
|
printk(KERN_ERR "firmware_sample_driver:"
|
||||||
"firmware_sample_driver:"
|
|
||||||
" request_firmware_nowait failed\n");
|
" request_firmware_nowait failed\n");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static int sample_init(void)
|
static int sample_init(void)
|
||||||
{
|
{
|
||||||
@ -105,6 +109,7 @@ static int sample_init(void)
|
|||||||
sample_probe_async();
|
sample_probe_async();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit sample_exit(void)
|
static void __exit sample_exit(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -27,28 +27,25 @@ static inline struct class_device *to_class_dev(struct kobject *obj)
|
|||||||
{
|
{
|
||||||
return container_of(obj, struct class_device, kobj);
|
return container_of(obj, struct class_device, kobj);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
struct class_device_attribute *to_class_dev_attr(struct attribute *_attr)
|
struct class_device_attribute *to_class_dev_attr(struct attribute *_attr)
|
||||||
{
|
{
|
||||||
return container_of(_attr, struct class_device_attribute, attr);
|
return container_of(_attr, struct class_device_attribute, attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr);
|
|
||||||
int sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * attr);
|
|
||||||
|
|
||||||
struct firmware_priv {
|
struct firmware_priv {
|
||||||
char fw_id[FIRMWARE_NAME_MAX];
|
char fw_id[FIRMWARE_NAME_MAX];
|
||||||
s32 loading:2;
|
s32 loading:2;
|
||||||
u32 abort:1;
|
u32 abort:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct class firmware_class;
|
|
||||||
|
|
||||||
static ssize_t firmware_loading_show(struct class_device *class_dev, char *buf)
|
static ssize_t firmware_loading_show(struct class_device *class_dev, char *buf)
|
||||||
{
|
{
|
||||||
struct firmware_priv *fw_priv = class_get_devdata(class_dev);
|
struct firmware_priv *fw_priv = class_get_devdata(class_dev);
|
||||||
return sprintf(buf, "%d\n", fw_priv->loading);
|
return sprintf(buf, "%d\n", fw_priv->loading);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t firmware_loading_store(struct class_device *class_dev,
|
static ssize_t firmware_loading_store(struct class_device *class_dev,
|
||||||
const char *buf, size_t count)
|
const char *buf, size_t count)
|
||||||
{
|
{
|
||||||
@ -132,14 +129,14 @@ static int fw_setup_class_device(struct class_device *class_dev,
|
|||||||
retval = class_device_register(class_dev);
|
retval = class_device_register(class_dev);
|
||||||
if (retval) {
|
if (retval) {
|
||||||
printk(KERN_ERR "%s: class_device_register failed\n",
|
printk(KERN_ERR "%s: class_device_register failed\n",
|
||||||
__FUNCTION__);
|
__func__);
|
||||||
goto error_free_fw_priv;
|
goto error_free_fw_priv;
|
||||||
}
|
}
|
||||||
|
|
||||||
retval = sysfs_create_bin_file(&class_dev->kobj, &firmware_attr_data);
|
retval = sysfs_create_bin_file(&class_dev->kobj, &firmware_attr_data);
|
||||||
if (retval) {
|
if (retval) {
|
||||||
printk(KERN_ERR "%s: sysfs_create_bin_file failed\n",
|
printk(KERN_ERR "%s: sysfs_create_bin_file failed\n",
|
||||||
__FUNCTION__);
|
__func__);
|
||||||
goto error_unreg_class_dev;
|
goto error_unreg_class_dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +144,7 @@ static int fw_setup_class_device(struct class_device *class_dev,
|
|||||||
&class_device_attr_loading);
|
&class_device_attr_loading);
|
||||||
if (retval) {
|
if (retval) {
|
||||||
printk(KERN_ERR "%s: class_device_create_file failed\n",
|
printk(KERN_ERR "%s: class_device_create_file failed\n",
|
||||||
__FUNCTION__);
|
__func__);
|
||||||
goto error_remove_data;
|
goto error_remove_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user