Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Haiyue Wang and committed by
Corey Minyard
3b6d082f 364993a9

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