From patchwork Fri Nov 9 02:39:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Farman X-Patchwork-Id: 10675245 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2726518FD for ; Fri, 9 Nov 2018 02:40:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DEE32EB52 for ; Fri, 9 Nov 2018 02:40:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 015E52EB71; Fri, 9 Nov 2018 02:40:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 762982EB52 for ; Fri, 9 Nov 2018 02:40:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727718AbeKIMSk (ORCPT ); Fri, 9 Nov 2018 07:18:40 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:55722 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727553AbeKIMSk (ORCPT ); Fri, 9 Nov 2018 07:18:40 -0500 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wA92XVKU030124 for ; Thu, 8 Nov 2018 21:40:09 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2nmyrwus8b-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 08 Nov 2018 21:40:09 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 9 Nov 2018 02:40:07 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 9 Nov 2018 02:40:05 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wA92e32S7143892 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 9 Nov 2018 02:40:03 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 996FE4C046; Fri, 9 Nov 2018 02:40:03 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 813FD4C040; Fri, 9 Nov 2018 02:40:03 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 9 Nov 2018 02:40:03 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 4958) id 072AF20F651; Fri, 9 Nov 2018 03:40:03 +0100 (CET) From: Eric Farman To: Cornelia Huck , Pierre Morel Cc: Eric Farman , linux-s390@vger.kernel.org, kvm@vger.kernel.org, Halil Pasic , Farhan Ali , "Jason J . Herne" Subject: [RFC PATCH v1 10/10] s390/cio: Remove unused function/variables FIXUP Date: Fri, 9 Nov 2018 03:39:37 +0100 X-Mailer: git-send-email 2.16.4 In-Reply-To: <20181109023937.96105-1-farman@linux.ibm.com> References: <20181109023937.96105-1-farman@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18110902-0020-0000-0000-000002E3FBAF X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18110902-0021-0000-0000-0000213382D9 Message-Id: <20181109023937.96105-11-farman@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-11-08_13:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1811090022 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This should be squashed into the previous commit. It removes things that that are no longer used, and thus causing compiler warnings, but is split out to help with the readability of the refactoring that happened in the previous commit. Signed-off-by: Eric Farman --- drivers/s390/cio/vfio_ccw_cp.c | 70 ++++++++++-------------------------------- 1 file changed, 16 insertions(+), 54 deletions(-) diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/drivers/s390/cio/vfio_ccw_cp.c index d502dcd09d9a..ee3be5391edc 100644 --- a/drivers/s390/cio/vfio_ccw_cp.c +++ b/drivers/s390/cio/vfio_ccw_cp.c @@ -33,11 +33,6 @@ struct pfn_array { int pa_nr; }; -struct pfn_array_table { - struct pfn_array *pat_pa; - int pat_nr; -}; - struct ccwchain { struct list_head next; struct ccw1 *ch_ccw; @@ -97,52 +92,24 @@ static void pfn_array_unpin_free(struct pfn_array *pa, struct device *mdev) kfree(pa->pa_iova_pfn); } -static int pfn_array_table_init(struct pfn_array_table *pat, int nr) -{ - pat->pat_pa = kcalloc(nr, sizeof(*pat->pat_pa), GFP_KERNEL); - if (unlikely(ZERO_OR_NULL_PTR(pat->pat_pa))) { - pat->pat_nr = 0; - return -ENOMEM; - } - - pat->pat_nr = nr; - - return 0; -} - -static void pfn_array_table_unpin_free(struct pfn_array_table *pat, - struct device *mdev) -{ - int i; - - for (i = 0; i < pat->pat_nr; i++) - pfn_array_unpin_free(pat->pat_pa + i, mdev); - - if (pat->pat_nr) { - kfree(pat->pat_pa); - pat->pat_pa = NULL; - pat->pat_nr = 0; - } -} - -static bool pfn_array_table_iova_pinned(struct pfn_array *pa, - unsigned long iova) +static bool pfn_array_iova_pinned(struct pfn_array *pa, + unsigned long iova) { unsigned long iova_pfn = iova >> PAGE_SHIFT; - int i, j; + int i; - for (j = 0; j < pa->pa_nr; j++) - if (pa->pa_iova_pfn[j] == iova_pfn) - return true; + for (i = 0; i < pa->pa_nr; i++) + if (pa->pa_iova_pfn[i] == iova_pfn) + return true; return false; } -/* Create the list idal words for a pfn_array_table. */ -static inline void pfn_array_table_idal_create_words( + +static inline void pfn_array_idal_create_words( struct pfn_array *pa, unsigned long *idaws) { - int i, j, k; + int i; /* * Idal words (execept the first one) rely on the memory being 4k @@ -151,15 +118,12 @@ static inline void pfn_array_table_idal_create_words( * there will be no problem here to simply use the phys to create an * idaw. */ - k = 0; - for (j = 0; j < pa->pa_nr; j++) { - idaws[k] = pa->pa_pfn[j] << PAGE_SHIFT; - if (k == 0) - idaws[k] += pa->pa_iova & (PAGE_SIZE - 1); - k++; - } -} + for (i = 0; i < pa->pa_nr; i++) + idaws[i] = pa->pa_pfn[i] << PAGE_SHIFT; + + idaws[0] += pa->pa_iova & (PAGE_SIZE - 1); +} /* * Within the domain (@mdev), copy @n bytes from a guest physical @@ -431,7 +395,6 @@ static int ccwchain_fetch_ccw(struct ccwchain *chain, struct channel_program *cp) { struct ccw1 *ccw; - struct pfn_array_table *pat; struct pfn_array *pa; unsigned long *idaws; u64 idaw_iova; @@ -503,7 +466,7 @@ static int ccwchain_fetch_ccw(struct ccwchain *chain, ccw->cda = virt_to_phys(idaws); ccw->flags |= CCW_FLAG_IDA; - pfn_array_table_idal_create_words(pa, idaws); + pfn_array_idal_create_words(pa, idaws); return 0; @@ -789,8 +752,7 @@ bool cp_iova_pinned(struct channel_program *cp, u64 iova) list_for_each_entry(chain, &cp->ccwchain_list, next) { for (i = 0; i < chain->ch_len; i++) - if (pfn_array_table_iova_pinned(chain->ch_pa + i, - iova)) + if (pfn_array_iova_pinned(chain->ch_pa + i, iova)) return true; }