Received: by 10.223.185.116 with SMTP id b49csp640542wrg; Tue, 20 Feb 2018 05:32:31 -0800 (PST) X-Google-Smtp-Source: AH8x226ToHaE9XFmppSlKPIb7Pti6mCwkZEHilJGIQmn0oOZ44eQ5O1isiCazDjEWEGhsv8HsedZ X-Received: by 10.167.129.24 with SMTP id b24mr12244859pfi.183.1519133551184; Tue, 20 Feb 2018 05:32:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519133551; cv=none; d=google.com; s=arc-20160816; b=b11+lfcWSHTv8V3uV/aJnoUjt8z57V149auWa425uuJaQP6yYMItkctZyx8m36Nq7k Aoe+7F2P/38jNTEwb4l4Vdw3FhdkWVv7C1l8qhXqBQlXoog7M9RADnkszIjE0NJBXk1r Px72AlD4KQ5VP6aPoiCznw1sf8TlnXj3ghnNgjvB0NGOxXCsj8lHI25ooj+DoOW4PdDr cDFQmMhk1UM7NlOK64ki/w3npYvQYUh8pNcye/S2Jq5DLGRNlqCnNHSsb9d3DXc8D4o2 JO6jVWFq7eLZ4eWv6RwjAiTP4zCtGatm05kWaePCNsXLZ2mS29g73gySzp9oUF95rnOx Gk0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:reply-to:dkim-signature :arc-authentication-results; bh=rpub69xIkVAUojMZMc9D4DOOt4pE9sudys03UsTR63Q=; b=EXVAHT0uTST/sE+pUsHg4uD5Vlm2qF9tGZWep7pLfF+1PchsQpVwckMzwK8Dvdtsbs tl0QOGCpSivQvM75XWsuh3KmhVvCnDI4kNo5kultPAYtz9DlHJjVYAv/YXyy66OZK9Ch iaKYE04HIrq26iCLQYmbtM5a3wpMXOhKnIMdpA2CqNr90aX5x2GeBdlgMR+Dw0vCxpYM w9X4PGuNP1JBMrq/UlLqT2x9Q0MRiYUQbtBjI3fN0jYuLgu6JQYWH22xrTJ7zd9QX9GV So2VKHT2AKeT5Lg04iMFCB6WmKdHqeFZa3q5YeT+VOxzrnhn0WjdfivOm5u8+zlN2L1W sDMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=QFl2DTF/; 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 u10-v6si7178755plu.362.2018.02.20.05.32.04; Tue, 20 Feb 2018 05:32:31 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=QFl2DTF/; 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 S1752049AbeBTN3Z (ORCPT + 99 others); Tue, 20 Feb 2018 08:29:25 -0500 Received: from mail-oi0-f68.google.com ([209.85.218.68]:46032 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751737AbeBTN3W (ORCPT ); Tue, 20 Feb 2018 08:29:22 -0500 Received: by mail-oi0-f68.google.com with SMTP id j79so5723121oib.12 for ; Tue, 20 Feb 2018 05:29:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:reply-to:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=rpub69xIkVAUojMZMc9D4DOOt4pE9sudys03UsTR63Q=; b=QFl2DTF/uJhlDygvWz/LNmKIEMRUJU3Jg+W2j6apQQoqjzjh3EJA2L2BxbInrcRT6x m+rWztDGZ0B+gCX66GIgWTMcfcAIbJjJjNcdSEBcTpkeh4/kv8CKhMHODiQ8rbzBCRve qXBNRBFoeWF0nYN/F4W9/ORmW19ay70yKjDKPi21jrDyT3fz+qVMAezoBNmyTwo2yZ9S 29a4TPrhcslxzCY128HbxYxvXXhkkdtqGwG4Uvs1/0um6Xl7Bh5HSbioMQtoTWg4A0qN i/l5m35qbvw9l+KOyORWaKmO0+hbkN0zSB91kGAPxs3pVPZs/QxWKMQCyzx1NxSS/G1i pSCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:reply-to:subject:to:references:from :message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding:content-language; bh=rpub69xIkVAUojMZMc9D4DOOt4pE9sudys03UsTR63Q=; b=LQkVfMXj7yK1uOYxm2wwY4PP1t2kI87fd5usmGNmrrzDK6FuMleLxudE9AekvQ+85+ 6yUzHvs8QIL3cQlSF3gN/ZC02EPWZu1+Kt3Oi4AbrfWm5WpAslHTTl+9ECsC9fbOwaLM /dRc7kX/AG97Hxw2GJtIQFfIetDwWxTCwp8f9cGnZGIPfZRxDtAGp2Tv1nhZDhj+6lAz bkaXIey/hl9aRtzVW8D0VcDr92dFCJzyznScrX3aW1hIxfcVhVrsDF/MfpWM3nOns7lc iJ6nMCb9eVg+6NxA4TXSP0oc6M6L6e8R1S1u3WzHKgBuGmLNf8BPrK7iJoLFlw0SPncT IqrQ== X-Gm-Message-State: APf1xPD1RZbVOQly5AzJ87XI/oXIrLk3HmVcKcBSP89SAmoYq3Ua3RMo 1uRviJD8Ezmqncfi+tlDpw== X-Received: by 10.202.117.146 with SMTP id q140mr8766256oic.319.1519133361607; Tue, 20 Feb 2018 05:29:21 -0800 (PST) Received: from serve.minyard.net ([47.184.168.85]) by smtp.gmail.com with ESMTPSA id v125sm6028634oie.8.2018.02.20.05.29.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Feb 2018 05:29:20 -0800 (PST) Received: from [192.168.27.3] (t430m.minyard.net [192.168.27.3]) by serve.minyard.net (Postfix) with ESMTPSA id 58C28688; Tue, 20 Feb 2018 07:29:19 -0600 (CST) Reply-To: minyard@acm.org Subject: Re: [PATCH ipmi/kcs_bmc v2] ipmi: kcs_bmc: make the code be more clean To: Haiyue Wang , openipmi-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org References: <1519055731-18923-1-git-send-email-haiyue.wang@linux.intel.com> From: Corey Minyard Message-ID: <9b5afddc-1c28-d5cf-d7ee-71a389592073@acm.org> Date: Tue, 20 Feb 2018 07:29:18 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1519055731-18923-1-git-send-email-haiyue.wang@linux.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/19/2018 09:55 AM, Haiyue Wang wrote: > --- When you use ---, it means everything following is not in the commit text, including your signature. > v1 -> v2: Do you want me to fold this into the previous patch?  That's generally not how things work, a new patch is fine for this, with a list of things done like below. One comment inline below... > > Add 'SPDX-License-Identifier' style for header files modification. > --- > > 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. > 4. Correct the 'SPDX-License-Identifier' style for header files. > > Signed-off-by: Haiyue Wang > --- > 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; I get this:   CC [M]  drivers/char/ipmi/kcs_bmc.o ../drivers/char/ipmi/kcs_bmc.c: In function ‘kcs_bmc_poll’: ../drivers/char/ipmi/kcs_bmc.c:276:11: error: ‘EPOLLIN’ undeclared (first use in this function)    mask |= EPOLLIN;            ^ ../drivers/char/ipmi/kcs_bmc.c:276:11: note: each undeclared identifier is reported only once for each function it appears in probably need to include linux/eventpoll.h -corey > 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