Received: by 10.223.185.116 with SMTP id b49csp3958475wrg; Mon, 26 Feb 2018 08:51:06 -0800 (PST) X-Google-Smtp-Source: AH8x224n9JfQtMthaNbD4Zh06pAVIKN95oNDI3V0iV5+VNfUZ6tMF4CNuiXFi6gmEnxMWdlJiLQv X-Received: by 2002:a17:902:9009:: with SMTP id a9-v6mr10946558plp.272.1519663866294; Mon, 26 Feb 2018 08:51:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519663866; cv=none; d=google.com; s=arc-20160816; b=x5ilUy3SVzPAzaYr6Bi08Jx74jocngKZncL5NLbA7Mkm7leFt7nXnGLhNo4kqTfZjF jxX/ud5noPRv4FlqaI852go2WoEcANEgzbKYpc+jTydULwdPC0uZvq7+wiUgOzlI17sA X2pBCQqS+P8n1teoMe/WBbYT3VQJFRgDuGfxuYSy2QxYzyjDWAxyAXuT5xf9vb/PJI33 nAury4ShmeH/5PjHEWeQiyxg7if1h9JUw/YIZk7EhQtRrl4UlQA0QlkcTbVT4uyl81kq MjDCrS3UdMXMhxnQIreqXK1cKufdBIEsWoZYab0UvKHNnkMmyTaYKX2rGYuwX4rHxn4Q +ePQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=W5Gb7ONu6wnWjNRxWxDU9JLjecl1Mdc0D+6FPztMW4k=; b=xxw0nC9UQDDjIp5/0XLIod09/xb0V4SRmg6+L/WAKPbfErE69Pz2ZeyIWz5YZm5r1Y quEO2uU8CCL4inlebKFtdOUo/wt8uF9K8SuCaTdO0aH2hMrjBftVEEe2qAJ7D6Z1iqff 5pNURrONV4oIyuQJuv5b1AeuXdrn3ShWtGZJu2s11IkFhwD0rjhnuJba87SfNL84B/uo 69I0kIkupDV/ZH67ONLKiUemO9Y57M45A11PmtYqi+XUbq1ICFd2dmnGJXOjeVug6C/D V/6aDzP1l3FAsEVpGHvYThHaaGg5hiKFojXuJE/COyVIN0Lgsq7YnCW/gbw0tDQTJY+c YQJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g21si5131022pfh.379.2018.02.26.08.50.51; Mon, 26 Feb 2018 08:51:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752112AbeBZPaW (ORCPT + 99 others); Mon, 26 Feb 2018 10:30:22 -0500 Received: from mga02.intel.com ([134.134.136.20]:36755 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751570AbeBZPaG (ORCPT ); Mon, 26 Feb 2018 10:30:06 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Feb 2018 07:30:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,397,1515484800"; d="scan'208";a="20306759" Received: from build0101.sh.intel.com ([10.239.164.138]) by fmsmga007.fm.intel.com with ESMTP; 26 Feb 2018 07:30:04 -0800 From: Haiyue Wang To: minyard@acm.org, openipmi-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org Cc: Haiyue Wang Subject: [PATCH ipmi/kcs_bmc v5] ipmi: kcs_bmc: coding-style fixes and use new poll type Date: Mon, 26 Feb 2018 23:31:12 +0800 Message-Id: <1519659072-9053-1-git-send-email-haiyue.wang@linux.intel.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- v4 -> v5: - Simplify the commit title and message. - Change the 'MODULE_DEVICE_TABLE' position. v3 -> v4: - Correct the header file's macro defination end comment which is old file name, I forgot to change it after changing the file name. - Remove the space between the comment words and colon. v2 -> v3: - Make the commit message be more understandable. v1 -> v2: - Add 'SPDX-License-Identifier' style for header files modification. --- drivers/char/ipmi/kcs_bmc.c | 30 ++++++++++++++++-------------- drivers/char/ipmi/kcs_bmc.h | 36 +++++++++++++++++++----------------- drivers/char/ipmi/kcs_bmc_aspeed.c | 9 +++++---- include/uapi/linux/ipmi_bmc.h | 8 +++++--- 4 files changed, 45 insertions(+), 38 deletions(-) diff --git a/drivers/char/ipmi/kcs_bmc.c b/drivers/char/ipmi/kcs_bmc.c index 6476bfb..1e51903 100644 --- a/drivers/char/ipmi/kcs_bmc.c +++ b/drivers/char/ipmi/kcs_bmc.c @@ -1,5 +1,7 @@ // 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 @@ -242,14 +244,14 @@ int kcs_bmc_handle_event(struct kcs_bmc *kcs_bmc) } 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); } 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; spin_lock_irq(&kcs_bmc->lock); @@ -262,10 +264,10 @@ static int kcs_bmc_open(struct inode *inode, struct file *filp) 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); - unsigned int mask = 0; + struct kcs_bmc *kcs_bmc = to_kcs_bmc(filp); + __poll_t mask = 0; poll_wait(filp, &kcs_bmc->queue, wait); @@ -277,10 +279,10 @@ static unsigned int kcs_bmc_poll(struct file *filp, poll_table *wait) return mask; } -static ssize_t kcs_bmc_read(struct file *filp, char *buf, - size_t count, loff_t *offset) +static ssize_t kcs_bmc_read(struct file *filp, char __user *buf, + 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; size_t data_len; ssize_t ret; @@ -339,10 +341,10 @@ static ssize_t kcs_bmc_read(struct file *filp, char *buf, return ret; } -static ssize_t kcs_bmc_write(struct file *filp, const char *buf, - size_t count, loff_t *offset) +static ssize_t kcs_bmc_write(struct file *filp, const char __user *buf, + 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; /* a minimum response size '3' : netfn + cmd + ccode */ @@ -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, 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; spin_lock_irq(&kcs_bmc->lock); @@ -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) { - 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); kcs_bmc->running = 0; diff --git a/drivers/char/ipmi/kcs_bmc.h b/drivers/char/ipmi/kcs_bmc.h index c19501d..eb9ea4c 100644 --- a/drivers/char/ipmi/kcs_bmc.h +++ b/drivers/char/ipmi/kcs_bmc.h @@ -1,31 +1,33 @@ -// SPDX-License-Identifier: GPL-2.0 -// Copyright (c) 2015-2018, Intel Corporation. +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2015-2018, Intel Corporation. + */ #ifndef __KCS_BMC_H__ #define __KCS_BMC_H__ #include -/* Different phases of the KCS BMC module : - * KCS_PHASE_IDLE : +/* Different phases of the KCS BMC module. + * KCS_PHASE_IDLE: * 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. - * KCS_PHASE_WRITE_DATA : + * KCS_PHASE_WRITE_DATA: * 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. - * KCS_PHASE_WRITE_DONE : + * KCS_PHASE_WRITE_DONE: * 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. - * KCS_PHASE_READ : + * KCS_PHASE_READ: * 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. - * KCS_PHASE_ABORT_ERROR2 : + * KCS_PHASE_ABORT_ERROR2: * 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. */ enum kcs_phases { @@ -54,9 +56,9 @@ enum kcs_errors { }; /* IPMI 2.0 - 9.5, KCS Interface Registers - * @idr : Input Data Register - * @odr : Output Data Register - * @str : Status Register + * @idr: Input Data Register + * @odr: Output Data Register + * @str: Status Register */ struct kcs_ioreg { u32 idr; @@ -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); struct kcs_bmc *kcs_bmc_alloc(struct device *dev, int sizeof_priv, u32 channel); -#endif +#endif /* __KCS_BMC_H__ */ diff --git a/drivers/char/ipmi/kcs_bmc_aspeed.c b/drivers/char/ipmi/kcs_bmc_aspeed.c index 0c4d1a3..3c95594 100644 --- a/drivers/char/ipmi/kcs_bmc_aspeed.c +++ b/drivers/char/ipmi/kcs_bmc_aspeed.c @@ -1,5 +1,7 @@ // 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 @@ -301,19 +303,18 @@ static const struct of_device_id ast_kcs_bmc_match[] = { { .compatible = "aspeed,ast2500-kcs-bmc" }, { } }; +MODULE_DEVICE_TABLE(of, ast_kcs_bmc_match); static struct platform_driver ast_kcs_bmc_driver = { .driver = { .name = DEVICE_NAME, .of_match_table = ast_kcs_bmc_match, }, - .probe = aspeed_kcs_probe, + .probe = aspeed_kcs_probe, .remove = aspeed_kcs_remove, }; - module_platform_driver(ast_kcs_bmc_driver); -MODULE_DEVICE_TABLE(of, ast_kcs_bmc_match); MODULE_LICENSE("GPL v2"); MODULE_AUTHOR("Haiyue Wang "); MODULE_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 2f9f97e..1670f09 100644 --- a/include/uapi/linux/ipmi_bmc.h +++ b/include/uapi/linux/ipmi_bmc.h @@ -1,5 +1,7 @@ -// SPDX-License-Identifier: GPL-2.0 -// Copyright (c) 2015-2018, Intel Corporation. +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2015-2018, Intel Corporation. + */ #ifndef _UAPI_LINUX_IPMI_BMC_H #define _UAPI_LINUX_IPMI_BMC_H @@ -11,4 +13,4 @@ #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) -#endif /* _UAPI_LINUX_KCS_BMC_H */ +#endif /* _UAPI_LINUX_IPMI_BMC_H */ -- 2.7.4