Commit 3b6d082f authored by Haiyue Wang's avatar Haiyue Wang Committed by Corey Minyard

ipmi: kcs_bmc: coding-style fixes and use new poll type

Many for coding-style fixes, and update the poll API with the new
type '__poll_t', this is new commit from linux-4.16-rc1.
Signed-off-by: default avatarHaiyue Wang <haiyue.wang@linux.intel.com>
Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
parent 364993a9
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2015-2018, Intel Corporation. /*
* Copyright (c) 2015-2018, Intel Corporation.
*/
#define pr_fmt(fmt) "kcs-bmc: " fmt #define pr_fmt(fmt) "kcs-bmc: " fmt
...@@ -242,14 +244,14 @@ int kcs_bmc_handle_event(struct kcs_bmc *kcs_bmc) ...@@ -242,14 +244,14 @@ int kcs_bmc_handle_event(struct kcs_bmc *kcs_bmc)
} }
EXPORT_SYMBOL(kcs_bmc_handle_event); EXPORT_SYMBOL(kcs_bmc_handle_event);
static inline struct kcs_bmc *file_to_kcs_bmc(struct file *filp) static inline struct kcs_bmc *to_kcs_bmc(struct file *filp)
{ {
return container_of(filp->private_data, struct kcs_bmc, miscdev); return container_of(filp->private_data, struct kcs_bmc, miscdev);
} }
static int kcs_bmc_open(struct inode *inode, struct file *filp) static int kcs_bmc_open(struct inode *inode, struct file *filp)
{ {
struct kcs_bmc *kcs_bmc = file_to_kcs_bmc(filp); struct kcs_bmc *kcs_bmc = to_kcs_bmc(filp);
int ret = 0; int ret = 0;
spin_lock_irq(&kcs_bmc->lock); spin_lock_irq(&kcs_bmc->lock);
...@@ -262,25 +264,25 @@ static int kcs_bmc_open(struct inode *inode, struct file *filp) ...@@ -262,25 +264,25 @@ static int kcs_bmc_open(struct inode *inode, struct file *filp)
return ret; return ret;
} }
static unsigned int kcs_bmc_poll(struct file *filp, poll_table *wait) static __poll_t kcs_bmc_poll(struct file *filp, poll_table *wait)
{ {
struct kcs_bmc *kcs_bmc = file_to_kcs_bmc(filp); struct kcs_bmc *kcs_bmc = to_kcs_bmc(filp);
unsigned int mask = 0; __poll_t mask = 0;
poll_wait(filp, &kcs_bmc->queue, wait); poll_wait(filp, &kcs_bmc->queue, wait);
spin_lock_irq(&kcs_bmc->lock); spin_lock_irq(&kcs_bmc->lock);
if (kcs_bmc->data_in_avail) if (kcs_bmc->data_in_avail)
mask |= POLLIN; mask |= EPOLLIN;
spin_unlock_irq(&kcs_bmc->lock); spin_unlock_irq(&kcs_bmc->lock);
return mask; return mask;
} }
static ssize_t kcs_bmc_read(struct file *filp, char *buf, static ssize_t kcs_bmc_read(struct file *filp, char __user *buf,
size_t count, loff_t *offset) size_t count, loff_t *ppos)
{ {
struct kcs_bmc *kcs_bmc = file_to_kcs_bmc(filp); struct kcs_bmc *kcs_bmc = to_kcs_bmc(filp);
bool data_avail; bool data_avail;
size_t data_len; size_t data_len;
ssize_t ret; ssize_t ret;
...@@ -339,10 +341,10 @@ static ssize_t kcs_bmc_read(struct file *filp, char *buf, ...@@ -339,10 +341,10 @@ static ssize_t kcs_bmc_read(struct file *filp, char *buf,
return ret; return ret;
} }
static ssize_t kcs_bmc_write(struct file *filp, const char *buf, static ssize_t kcs_bmc_write(struct file *filp, const char __user *buf,
size_t count, loff_t *offset) size_t count, loff_t *ppos)
{ {
struct kcs_bmc *kcs_bmc = file_to_kcs_bmc(filp); struct kcs_bmc *kcs_bmc = to_kcs_bmc(filp);
ssize_t ret; ssize_t ret;
/* a minimum response size '3' : netfn + cmd + ccode */ /* a minimum response size '3' : netfn + cmd + ccode */
...@@ -378,7 +380,7 @@ static ssize_t kcs_bmc_write(struct file *filp, const char *buf, ...@@ -378,7 +380,7 @@ static ssize_t kcs_bmc_write(struct file *filp, const char *buf,
static long kcs_bmc_ioctl(struct file *filp, unsigned int cmd, static long kcs_bmc_ioctl(struct file *filp, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
struct kcs_bmc *kcs_bmc = file_to_kcs_bmc(filp); struct kcs_bmc *kcs_bmc = to_kcs_bmc(filp);
long ret = 0; long ret = 0;
spin_lock_irq(&kcs_bmc->lock); spin_lock_irq(&kcs_bmc->lock);
...@@ -410,7 +412,7 @@ static long kcs_bmc_ioctl(struct file *filp, unsigned int cmd, ...@@ -410,7 +412,7 @@ static long kcs_bmc_ioctl(struct file *filp, unsigned int cmd,
static int kcs_bmc_release(struct inode *inode, struct file *filp) static int kcs_bmc_release(struct inode *inode, struct file *filp)
{ {
struct kcs_bmc *kcs_bmc = file_to_kcs_bmc(filp); struct kcs_bmc *kcs_bmc = to_kcs_bmc(filp);
spin_lock_irq(&kcs_bmc->lock); spin_lock_irq(&kcs_bmc->lock);
kcs_bmc->running = 0; kcs_bmc->running = 0;
......
// SPDX-License-Identifier: GPL-2.0 /* SPDX-License-Identifier: GPL-2.0 */
// Copyright (c) 2015-2018, Intel Corporation. /*
* Copyright (c) 2015-2018, Intel Corporation.
*/
#ifndef __KCS_BMC_H__ #ifndef __KCS_BMC_H__
#define __KCS_BMC_H__ #define __KCS_BMC_H__
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
/* Different phases of the KCS BMC module : /* Different phases of the KCS BMC module.
* KCS_PHASE_IDLE : * KCS_PHASE_IDLE:
* BMC should not be expecting nor sending any data. * BMC should not be expecting nor sending any data.
* KCS_PHASE_WRITE_START : * KCS_PHASE_WRITE_START:
* BMC is receiving a WRITE_START command from system software. * BMC is receiving a WRITE_START command from system software.
* KCS_PHASE_WRITE_DATA : * KCS_PHASE_WRITE_DATA:
* BMC is receiving a data byte from system software. * BMC is receiving a data byte from system software.
* KCS_PHASE_WRITE_END_CMD : * KCS_PHASE_WRITE_END_CMD:
* BMC is waiting a last data byte from system software. * BMC is waiting a last data byte from system software.
* KCS_PHASE_WRITE_DONE : * KCS_PHASE_WRITE_DONE:
* BMC has received the whole request from system software. * BMC has received the whole request from system software.
* KCS_PHASE_WAIT_READ : * KCS_PHASE_WAIT_READ:
* BMC is waiting the response from the upper IPMI service. * BMC is waiting the response from the upper IPMI service.
* KCS_PHASE_READ : * KCS_PHASE_READ:
* BMC is transferring the response to system software. * BMC is transferring the response to system software.
* KCS_PHASE_ABORT_ERROR1 : * KCS_PHASE_ABORT_ERROR1:
* BMC is waiting error status request from system software. * BMC is waiting error status request from system software.
* KCS_PHASE_ABORT_ERROR2 : * KCS_PHASE_ABORT_ERROR2:
* BMC is waiting for idle status afer error from system software. * BMC is waiting for idle status afer error from system software.
* KCS_PHASE_ERROR : * KCS_PHASE_ERROR:
* BMC has detected a protocol violation at the interface level. * BMC has detected a protocol violation at the interface level.
*/ */
enum kcs_phases { enum kcs_phases {
...@@ -54,9 +56,9 @@ enum kcs_errors { ...@@ -54,9 +56,9 @@ enum kcs_errors {
}; };
/* IPMI 2.0 - 9.5, KCS Interface Registers /* IPMI 2.0 - 9.5, KCS Interface Registers
* @idr : Input Data Register * @idr: Input Data Register
* @odr : Output Data Register * @odr: Output Data Register
* @str : Status Register * @str: Status Register
*/ */
struct kcs_ioreg { struct kcs_ioreg {
u32 idr; u32 idr;
...@@ -103,4 +105,4 @@ static inline void *kcs_bmc_priv(struct kcs_bmc *kcs_bmc) ...@@ -103,4 +105,4 @@ static inline void *kcs_bmc_priv(struct kcs_bmc *kcs_bmc)
int kcs_bmc_handle_event(struct kcs_bmc *kcs_bmc); int kcs_bmc_handle_event(struct kcs_bmc *kcs_bmc);
struct kcs_bmc *kcs_bmc_alloc(struct device *dev, int sizeof_priv, struct kcs_bmc *kcs_bmc_alloc(struct device *dev, int sizeof_priv,
u32 channel); u32 channel);
#endif #endif /* __KCS_BMC_H__ */
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2015-2018, Intel Corporation. /*
* Copyright (c) 2015-2018, Intel Corporation.
*/
#define pr_fmt(fmt) "aspeed-kcs-bmc: " fmt #define pr_fmt(fmt) "aspeed-kcs-bmc: " fmt
...@@ -301,19 +303,18 @@ static const struct of_device_id ast_kcs_bmc_match[] = { ...@@ -301,19 +303,18 @@ static const struct of_device_id ast_kcs_bmc_match[] = {
{ .compatible = "aspeed,ast2500-kcs-bmc" }, { .compatible = "aspeed,ast2500-kcs-bmc" },
{ } { }
}; };
MODULE_DEVICE_TABLE(of, ast_kcs_bmc_match);
static struct platform_driver ast_kcs_bmc_driver = { static struct platform_driver ast_kcs_bmc_driver = {
.driver = { .driver = {
.name = DEVICE_NAME, .name = DEVICE_NAME,
.of_match_table = ast_kcs_bmc_match, .of_match_table = ast_kcs_bmc_match,
}, },
.probe = aspeed_kcs_probe, .probe = aspeed_kcs_probe,
.remove = aspeed_kcs_remove, .remove = aspeed_kcs_remove,
}; };
module_platform_driver(ast_kcs_bmc_driver); module_platform_driver(ast_kcs_bmc_driver);
MODULE_DEVICE_TABLE(of, ast_kcs_bmc_match);
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Haiyue Wang <haiyue.wang@linux.intel.com>"); MODULE_AUTHOR("Haiyue Wang <haiyue.wang@linux.intel.com>");
MODULE_DESCRIPTION("Aspeed device interface to the KCS BMC device"); MODULE_DESCRIPTION("Aspeed device interface to the KCS BMC device");
// SPDX-License-Identifier: GPL-2.0 /* SPDX-License-Identifier: GPL-2.0 */
// Copyright (c) 2015-2018, Intel Corporation. /*
* Copyright (c) 2015-2018, Intel Corporation.
*/
#ifndef _UAPI_LINUX_IPMI_BMC_H #ifndef _UAPI_LINUX_IPMI_BMC_H
#define _UAPI_LINUX_IPMI_BMC_H #define _UAPI_LINUX_IPMI_BMC_H
...@@ -11,4 +13,4 @@ ...@@ -11,4 +13,4 @@
#define IPMI_BMC_IOCTL_CLEAR_SMS_ATN _IO(__IPMI_BMC_IOCTL_MAGIC, 0x01) #define IPMI_BMC_IOCTL_CLEAR_SMS_ATN _IO(__IPMI_BMC_IOCTL_MAGIC, 0x01)
#define IPMI_BMC_IOCTL_FORCE_ABORT _IO(__IPMI_BMC_IOCTL_MAGIC, 0x02) #define IPMI_BMC_IOCTL_FORCE_ABORT _IO(__IPMI_BMC_IOCTL_MAGIC, 0x02)
#endif /* _UAPI_LINUX_KCS_BMC_H */ #endif /* _UAPI_LINUX_IPMI_BMC_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment