aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHaiyue Wang <haiyue.wang@linux.intel.com>2018-02-26 10:48:14 -0500
committerCorey Minyard <cminyard@mvista.com>2018-02-26 10:49:21 -0500
commit3b6d082f0dfc2b7b9def494d2ab67fd4d3862ea1 (patch)
treee855e2508458dcaae37a65c68689a8759241a95d
parent364993a95888916b8906f655c8654aa60877a35b (diff)
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: Haiyue Wang <haiyue.wang@linux.intel.com> Signed-off-by: Corey Minyard <cminyard@mvista.com>
-rw-r--r--drivers/char/ipmi/kcs_bmc.c32
-rw-r--r--drivers/char/ipmi/kcs_bmc.h36
-rw-r--r--drivers/char/ipmi/kcs_bmc_aspeed.c9
-rw-r--r--include/uapi/linux/ipmi_bmc.h8
4 files changed, 46 insertions, 39 deletions
diff --git a/drivers/char/ipmi/kcs_bmc.c b/drivers/char/ipmi/kcs_bmc.c
index 6476bfb79f44..fbfc05e3f3d1 100644
--- a/drivers/char/ipmi/kcs_bmc.c
+++ b/drivers/char/ipmi/kcs_bmc.c
@@ -1,5 +1,7 @@
1// SPDX-License-Identifier: GPL-2.0 1// SPDX-License-Identifier: GPL-2.0
2// Copyright (c) 2015-2018, Intel Corporation. 2/*
3 * Copyright (c) 2015-2018, Intel Corporation.
4 */
3 5
4#define pr_fmt(fmt) "kcs-bmc: " fmt 6#define pr_fmt(fmt) "kcs-bmc: " fmt
5 7
@@ -242,14 +244,14 @@ out_unlock:
242} 244}
243EXPORT_SYMBOL(kcs_bmc_handle_event); 245EXPORT_SYMBOL(kcs_bmc_handle_event);
244 246
245static inline struct kcs_bmc *file_to_kcs_bmc(struct file *filp) 247static inline struct kcs_bmc *to_kcs_bmc(struct file *filp)
246{ 248{
247 return container_of(filp->private_data, struct kcs_bmc, miscdev); 249 return container_of(filp->private_data, struct kcs_bmc, miscdev);
248} 250}
249 251
250static int kcs_bmc_open(struct inode *inode, struct file *filp) 252static int kcs_bmc_open(struct inode *inode, struct file *filp)
251{ 253{
252 struct kcs_bmc *kcs_bmc = file_to_kcs_bmc(filp); 254 struct kcs_bmc *kcs_bmc = to_kcs_bmc(filp);
253 int ret = 0; 255 int ret = 0;
254 256
255 spin_lock_irq(&kcs_bmc->lock); 257 spin_lock_irq(&kcs_bmc->lock);
@@ -262,25 +264,25 @@ static int kcs_bmc_open(struct inode *inode, struct file *filp)
262 return ret; 264 return ret;
263} 265}
264 266
265static unsigned int kcs_bmc_poll(struct file *filp, poll_table *wait) 267static __poll_t kcs_bmc_poll(struct file *filp, poll_table *wait)
266{ 268{
267 struct kcs_bmc *kcs_bmc = file_to_kcs_bmc(filp); 269 struct kcs_bmc *kcs_bmc = to_kcs_bmc(filp);
268 unsigned int mask = 0; 270 __poll_t mask = 0;
269 271
270 poll_wait(filp, &kcs_bmc->queue, wait); 272 poll_wait(filp, &kcs_bmc->queue, wait);
271 273
272 spin_lock_irq(&kcs_bmc->lock); 274 spin_lock_irq(&kcs_bmc->lock);
273 if (kcs_bmc->data_in_avail) 275 if (kcs_bmc->data_in_avail)
274 mask |= POLLIN; 276 mask |= EPOLLIN;
275 spin_unlock_irq(&kcs_bmc->lock); 277 spin_unlock_irq(&kcs_bmc->lock);
276 278
277 return mask; 279 return mask;
278} 280}
279 281
280static ssize_t kcs_bmc_read(struct file *filp, char *buf, 282static ssize_t kcs_bmc_read(struct file *filp, char __user *buf,
281 size_t count, loff_t *offset) 283 size_t count, loff_t *ppos)
282{ 284{
283 struct kcs_bmc *kcs_bmc = file_to_kcs_bmc(filp); 285 struct kcs_bmc *kcs_bmc = to_kcs_bmc(filp);
284 bool data_avail; 286 bool data_avail;
285 size_t data_len; 287 size_t data_len;
286 ssize_t ret; 288 ssize_t ret;
@@ -339,10 +341,10 @@ out_unlock:
339 return ret; 341 return ret;
340} 342}
341 343
342static ssize_t kcs_bmc_write(struct file *filp, const char *buf, 344static ssize_t kcs_bmc_write(struct file *filp, const char __user *buf,
343 size_t count, loff_t *offset) 345 size_t count, loff_t *ppos)
344{ 346{
345 struct kcs_bmc *kcs_bmc = file_to_kcs_bmc(filp); 347 struct kcs_bmc *kcs_bmc = to_kcs_bmc(filp);
346 ssize_t ret; 348 ssize_t ret;
347 349
348 /* a minimum response size '3' : netfn + cmd + ccode */ 350 /* a minimum response size '3' : netfn + cmd + ccode */
@@ -378,7 +380,7 @@ out_unlock:
378static long kcs_bmc_ioctl(struct file *filp, unsigned int cmd, 380static long kcs_bmc_ioctl(struct file *filp, unsigned int cmd,
379 unsigned long arg) 381 unsigned long arg)
380{ 382{
381 struct kcs_bmc *kcs_bmc = file_to_kcs_bmc(filp); 383 struct kcs_bmc *kcs_bmc = to_kcs_bmc(filp);
382 long ret = 0; 384 long ret = 0;
383 385
384 spin_lock_irq(&kcs_bmc->lock); 386 spin_lock_irq(&kcs_bmc->lock);
@@ -410,7 +412,7 @@ static long kcs_bmc_ioctl(struct file *filp, unsigned int cmd,
410 412
411static int kcs_bmc_release(struct inode *inode, struct file *filp) 413static int kcs_bmc_release(struct inode *inode, struct file *filp)
412{ 414{
413 struct kcs_bmc *kcs_bmc = file_to_kcs_bmc(filp); 415 struct kcs_bmc *kcs_bmc = to_kcs_bmc(filp);
414 416
415 spin_lock_irq(&kcs_bmc->lock); 417 spin_lock_irq(&kcs_bmc->lock);
416 kcs_bmc->running = 0; 418 kcs_bmc->running = 0;
diff --git a/drivers/char/ipmi/kcs_bmc.h b/drivers/char/ipmi/kcs_bmc.h
index c19501db0236..eb9ea4ce78b8 100644
--- a/drivers/char/ipmi/kcs_bmc.h
+++ b/drivers/char/ipmi/kcs_bmc.h
@@ -1,31 +1,33 @@
1// SPDX-License-Identifier: GPL-2.0 1/* SPDX-License-Identifier: GPL-2.0 */
2// Copyright (c) 2015-2018, Intel Corporation. 2/*
3 * Copyright (c) 2015-2018, Intel Corporation.
4 */
3 5
4#ifndef __KCS_BMC_H__ 6#ifndef __KCS_BMC_H__
5#define __KCS_BMC_H__ 7#define __KCS_BMC_H__
6 8
7#include <linux/miscdevice.h> 9#include <linux/miscdevice.h>
8 10
9/* Different phases of the KCS BMC module : 11/* Different phases of the KCS BMC module.
10 * KCS_PHASE_IDLE : 12 * KCS_PHASE_IDLE:
11 * BMC should not be expecting nor sending any data. 13 * BMC should not be expecting nor sending any data.
12 * KCS_PHASE_WRITE_START : 14 * KCS_PHASE_WRITE_START:
13 * BMC is receiving a WRITE_START command from system software. 15 * BMC is receiving a WRITE_START command from system software.
14 * KCS_PHASE_WRITE_DATA : 16 * KCS_PHASE_WRITE_DATA:
15 * BMC is receiving a data byte from system software. 17 * BMC is receiving a data byte from system software.
16 * KCS_PHASE_WRITE_END_CMD : 18 * KCS_PHASE_WRITE_END_CMD:
17 * BMC is waiting a last data byte from system software. 19 * BMC is waiting a last data byte from system software.
18 * KCS_PHASE_WRITE_DONE : 20 * KCS_PHASE_WRITE_DONE:
19 * BMC has received the whole request from system software. 21 * BMC has received the whole request from system software.
20 * KCS_PHASE_WAIT_READ : 22 * KCS_PHASE_WAIT_READ:
21 * BMC is waiting the response from the upper IPMI service. 23 * BMC is waiting the response from the upper IPMI service.
22 * KCS_PHASE_READ : 24 * KCS_PHASE_READ:
23 * BMC is transferring the response to system software. 25 * BMC is transferring the response to system software.
24 * KCS_PHASE_ABORT_ERROR1 : 26 * KCS_PHASE_ABORT_ERROR1:
25 * BMC is waiting error status request from system software. 27 * BMC is waiting error status request from system software.
26 * KCS_PHASE_ABORT_ERROR2 : 28 * KCS_PHASE_ABORT_ERROR2:
27 * BMC is waiting for idle status afer error from system software. 29 * BMC is waiting for idle status afer error from system software.
28 * KCS_PHASE_ERROR : 30 * KCS_PHASE_ERROR:
29 * BMC has detected a protocol violation at the interface level. 31 * BMC has detected a protocol violation at the interface level.
30 */ 32 */
31enum kcs_phases { 33enum kcs_phases {
@@ -54,9 +56,9 @@ enum kcs_errors {
54}; 56};
55 57
56/* IPMI 2.0 - 9.5, KCS Interface Registers 58/* IPMI 2.0 - 9.5, KCS Interface Registers
57 * @idr : Input Data Register 59 * @idr: Input Data Register
58 * @odr : Output Data Register 60 * @odr: Output Data Register
59 * @str : Status Register 61 * @str: Status Register
60 */ 62 */
61struct kcs_ioreg { 63struct kcs_ioreg {
62 u32 idr; 64 u32 idr;
@@ -103,4 +105,4 @@ static inline void *kcs_bmc_priv(struct kcs_bmc *kcs_bmc)
103int kcs_bmc_handle_event(struct kcs_bmc *kcs_bmc); 105int kcs_bmc_handle_event(struct kcs_bmc *kcs_bmc);
104struct kcs_bmc *kcs_bmc_alloc(struct device *dev, int sizeof_priv, 106struct kcs_bmc *kcs_bmc_alloc(struct device *dev, int sizeof_priv,
105 u32 channel); 107 u32 channel);
106#endif 108#endif /* __KCS_BMC_H__ */
diff --git a/drivers/char/ipmi/kcs_bmc_aspeed.c b/drivers/char/ipmi/kcs_bmc_aspeed.c
index 0c4d1a36dae4..3c955946e647 100644
--- a/drivers/char/ipmi/kcs_bmc_aspeed.c
+++ b/drivers/char/ipmi/kcs_bmc_aspeed.c
@@ -1,5 +1,7 @@
1// SPDX-License-Identifier: GPL-2.0 1// SPDX-License-Identifier: GPL-2.0
2// Copyright (c) 2015-2018, Intel Corporation. 2/*
3 * Copyright (c) 2015-2018, Intel Corporation.
4 */
3 5
4#define pr_fmt(fmt) "aspeed-kcs-bmc: " fmt 6#define pr_fmt(fmt) "aspeed-kcs-bmc: " fmt
5 7
@@ -301,19 +303,18 @@ static const struct of_device_id ast_kcs_bmc_match[] = {
301 { .compatible = "aspeed,ast2500-kcs-bmc" }, 303 { .compatible = "aspeed,ast2500-kcs-bmc" },
302 { } 304 { }
303}; 305};
306MODULE_DEVICE_TABLE(of, ast_kcs_bmc_match);
304 307
305static struct platform_driver ast_kcs_bmc_driver = { 308static struct platform_driver ast_kcs_bmc_driver = {
306 .driver = { 309 .driver = {
307 .name = DEVICE_NAME, 310 .name = DEVICE_NAME,
308 .of_match_table = ast_kcs_bmc_match, 311 .of_match_table = ast_kcs_bmc_match,
309 }, 312 },
310 .probe = aspeed_kcs_probe, 313 .probe = aspeed_kcs_probe,
311 .remove = aspeed_kcs_remove, 314 .remove = aspeed_kcs_remove,
312}; 315};
313
314module_platform_driver(ast_kcs_bmc_driver); 316module_platform_driver(ast_kcs_bmc_driver);
315 317
316MODULE_DEVICE_TABLE(of, ast_kcs_bmc_match);
317MODULE_LICENSE("GPL v2"); 318MODULE_LICENSE("GPL v2");
318MODULE_AUTHOR("Haiyue Wang <haiyue.wang@linux.intel.com>"); 319MODULE_AUTHOR("Haiyue Wang <haiyue.wang@linux.intel.com>");
319MODULE_DESCRIPTION("Aspeed device interface to the KCS BMC device"); 320MODULE_DESCRIPTION("Aspeed device interface to the KCS BMC device");
diff --git a/include/uapi/linux/ipmi_bmc.h b/include/uapi/linux/ipmi_bmc.h
index 2f9f97e6123a..1670f0944227 100644
--- a/include/uapi/linux/ipmi_bmc.h
+++ b/include/uapi/linux/ipmi_bmc.h
@@ -1,5 +1,7 @@
1// SPDX-License-Identifier: GPL-2.0 1/* SPDX-License-Identifier: GPL-2.0 */
2// Copyright (c) 2015-2018, Intel Corporation. 2/*
3 * Copyright (c) 2015-2018, Intel Corporation.
4 */
3 5
4#ifndef _UAPI_LINUX_IPMI_BMC_H 6#ifndef _UAPI_LINUX_IPMI_BMC_H
5#define _UAPI_LINUX_IPMI_BMC_H 7#define _UAPI_LINUX_IPMI_BMC_H
@@ -11,4 +13,4 @@
11#define IPMI_BMC_IOCTL_CLEAR_SMS_ATN _IO(__IPMI_BMC_IOCTL_MAGIC, 0x01) 13#define IPMI_BMC_IOCTL_CLEAR_SMS_ATN _IO(__IPMI_BMC_IOCTL_MAGIC, 0x01)
12#define IPMI_BMC_IOCTL_FORCE_ABORT _IO(__IPMI_BMC_IOCTL_MAGIC, 0x02) 14#define IPMI_BMC_IOCTL_FORCE_ABORT _IO(__IPMI_BMC_IOCTL_MAGIC, 0x02)
13 15
14#endif /* _UAPI_LINUX_KCS_BMC_H */ 16#endif /* _UAPI_LINUX_IPMI_BMC_H */