Received: by 10.223.185.116 with SMTP id b49csp631197wrg; Wed, 21 Feb 2018 04:28:29 -0800 (PST) X-Google-Smtp-Source: AH8x224wbpRxJjP6RAVLgH/X7gI6ZlBdVvgwE3rj/It5DSXAVAkjAiBvcqNsvi2LVrKpvCU1zgfM X-Received: by 2002:a17:902:7b92:: with SMTP id w18-v6mr2930195pll.159.1519216109456; Wed, 21 Feb 2018 04:28:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519216109; cv=none; d=google.com; s=arc-20160816; b=0MAGKh5QRlAQ569xz4mHOl3adKM6hOKfiAQnljxkPY3V/mrPlV5qRqFLcWM1Qs0UFe C2UDf66ODNK8374aa/NSm+IIJFQwvkmxMdmqjwTF6qsusaWj5J5E75UqkZ0bWwNk4V+Z OfRD25jEo1i3cCjYfaI4gViWtGWl2DFZr2euuL/ZpP4UYOymnSxns4JliwWkMhj1LVKg CieYylDM6+pwDpLNY3cvdBUk4nE21ThERaUNldHLI/je7Ish+HEsWHADQQU07Ampw/xT x/zFShSyuqwgf4MaU18bj8zu/XS0SC9dWo3cTdYvah4Rm6rr2/PfqI3vUN9HUnUxx1Bw kK4g== 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=Mcsyif9ue7SDSVqRns3jusT9fUFfA30xXGrNbevOrfQ=; b=L5p6FAkRPOP9qLpP0wSlY+9xZNG9xEBDy7ItogVZU0hjeD0j2TJLQu/IfLMwxeaPkF XtZGJC2x4OqxuffDiWPJ/tQkPqG/jzhED/Ko4ZMnGEOp+HtR5VILDuWw0HX7/F7QxFy9 3jTT3tz2BAt02oSHNQ29a1cPitabIYrXkFuid0GnRN4xrrIxUymElAucTiTRaGz6WBvm 5nRVY6W5Lv/Tnij1B1yDb2i2flJ2SQoccMreLMCLSXpjCnaBgwPpQXlb3YYBSGuN1axn 6xNSK2Eo0wGDimJoQN7S1Y76B7hI5BW1dIreC/dC7C01MQxTsIAlxwSInGIMsOp/rzFh XSFg== 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 g10si469614pgf.160.2018.02.21.04.28.15; Wed, 21 Feb 2018 04:28:29 -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 S1752998AbeBUJDr (ORCPT + 99 others); Wed, 21 Feb 2018 04:03:47 -0500 Received: from mga07.intel.com ([134.134.136.100]:37564 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751461AbeBUJDp (ORCPT ); Wed, 21 Feb 2018 04:03:45 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Feb 2018 01:03:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,543,1511856000"; d="scan'208";a="176895204" Received: from build0101.sh.intel.com ([10.239.164.138]) by orsmga004.jf.intel.com with ESMTP; 21 Feb 2018 01:03:43 -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 v3] ipmi: kcs_bmc: make the code be more clean Date: Wed, 21 Feb 2018 17:04:40 +0800 Message-Id: <1519203880-3497-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 Modify the file read and write operation API's parameter declaration to meet the name convention. Rename the helper function by following the to_() name style. Update the poll API with the new type '__poll_t', this is new commit from linux-4.16-rc1. Correct the header files comment style for 'SPDX-License-Identifier'. Signed-off-by: Haiyue Wang --- 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 | 32 +++++++++++++++++--------------- drivers/char/ipmi/kcs_bmc.h | 6 ++++-- drivers/char/ipmi/kcs_bmc_aspeed.c | 4 +++- include/uapi/linux/ipmi_bmc.h | 6 ++++-- 4 files changed, 28 insertions(+), 20 deletions(-) diff --git a/drivers/char/ipmi/kcs_bmc.c b/drivers/char/ipmi/kcs_bmc.c index 6476bfb..fbfc05e 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,25 +264,25 @@ 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); spin_lock_irq(&kcs_bmc->lock); if (kcs_bmc->data_in_avail) - mask |= POLLIN; + mask |= EPOLLIN; spin_unlock_irq(&kcs_bmc->lock); 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..69d9a70 100644 --- a/drivers/char/ipmi/kcs_bmc.h +++ b/drivers/char/ipmi/kcs_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 __KCS_BMC_H__ #define __KCS_BMC_H__ diff --git a/drivers/char/ipmi/kcs_bmc_aspeed.c b/drivers/char/ipmi/kcs_bmc_aspeed.c index 0c4d1a3..dba6075 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 diff --git a/include/uapi/linux/ipmi_bmc.h b/include/uapi/linux/ipmi_bmc.h index 2f9f97e..d3efacd 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 -- 2.7.4