Received: by 10.223.185.116 with SMTP id b49csp3739523wrg; Mon, 19 Feb 2018 05:17:43 -0800 (PST) X-Google-Smtp-Source: AH8x224RLrWBdths/NAiCwjRej4edonNwNXgvw46d8qlCJF0RoZXdQjkrZP/Fv3ONc4hgsOL9WYL X-Received: by 2002:a17:902:8e83:: with SMTP id bg3-v6mr14511015plb.246.1519046263397; Mon, 19 Feb 2018 05:17:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519046263; cv=none; d=google.com; s=arc-20160816; b=HSKPdgw9Er+XtfD4GAN4phvJMspJeHs+Z9peM5CA1op+/WLUAy0uDW1QcZSMuF4l7I 7YjKwSM4/ll5QvA6RG170hxWME7l0y6cZf2ZM56zTGiLXOgYtBXRmwi9bMAitV8oeVyX LF2UZ+wVzJtci1qf0/J1aZk0F+lJF7SE6GCL+5V6foe7jQEWOV7msOlETThTGMUSHEqs ov0I/C0Qks4Bj1y8yzd9V5x8dII40hKTf8UdHFvmSncl+YO4NUPNKkeuzFLh2shcehSh kAPmudLV4+B2f/5UZUS3t8EHwNkfSJGyvu//2dltUiNEwWhfeX7zOpCN5dVUg+mpcBID ktAg== 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=eglMIYKroTDCMhrTxWI9zCm7Ap0ayrVUvpLgdDvidLg=; b=SDzvbHlCNuOEowb2Eo7bjrNOPWvQdg5xbCBs+H2oukE17NrGCf3EXmyM1igrO9td6F L0KYXqlKQcQYePJD11VcWOs1LmjYv0aQGj5zuLyy1xM6/qca/NGiD79uAn/6iC9KHVCe rBxpk9l0CYqAEkR2GtHCWM9XinvCwNBCMvlLa5gE3VIFI5lSQen1DsPq5nVQ/rchAq/O vXLrn122q86wLyiTcs3/uWpVkLVvkqakzqGdcUmIP0unzCkggGb8N57xsHD05pvQCYKt M2Opft9R253tAo94gX8vTcEfne3rISh5XjTJCzeKm2azcnLvPIdlnBfRWN62QGCf77E1 Sq7A== 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 j11si10698887pff.406.2018.02.19.05.17.28; Mon, 19 Feb 2018 05:17:43 -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 S1752782AbeBSNQn (ORCPT + 99 others); Mon, 19 Feb 2018 08:16:43 -0500 Received: from mga07.intel.com ([134.134.136.100]:19259 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752666AbeBSNQm (ORCPT ); Mon, 19 Feb 2018 08:16:42 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Feb 2018 05:16:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,535,1511856000"; d="scan'208";a="202198410" Received: from build0101.sh.intel.com ([10.239.164.138]) by orsmga005.jf.intel.com with ESMTP; 19 Feb 2018 05:16:40 -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 v1] ipmi: kcs_bmc: make the code be more clean Date: Mon, 19 Feb 2018 21:17:34 +0800 Message-Id: <1519046254-17251-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 Hi Corey, I've changed some code style to meet with the whole Linux style. Please help to review. BR, Haiyue --- 1. Add the missed key word '__user' for read / write. 2. Remove the prefix 'file' of 'file_to_kcs_bmc', no need this duplicated word as its parameter has 'struct file *filp'. 3. Change the 'unsigned int' to '__poll_t' to meet the new 'poll' definition. Signed-off-by: Haiyue Wang --- drivers/char/ipmi/kcs_bmc.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/char/ipmi/kcs_bmc.c b/drivers/char/ipmi/kcs_bmc.c index 6476bfb..2fe55b0 100644 --- a/drivers/char/ipmi/kcs_bmc.c +++ b/drivers/char/ipmi/kcs_bmc.c @@ -242,14 +242,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 +262,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 +277,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 +339,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 +378,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 +410,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; -- 2.7.4