From patchwork Mon Sep 24 21:42:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hauke Mehrtens X-Patchwork-Id: 10612875 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 DC33614BD for ; Mon, 24 Sep 2018 21:42:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CEC3A2A779 for ; Mon, 24 Sep 2018 21:42:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C22662A786; Mon, 24 Sep 2018 21:42:32 +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 14F4C2A779 for ; Mon, 24 Sep 2018 21:42:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728650AbeIYDqh (ORCPT ); Mon, 24 Sep 2018 23:46:37 -0400 Received: from mx1.mailbox.org ([80.241.60.212]:33606 "EHLO mx1.mailbox.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728647AbeIYDqh (ORCPT ); Mon, 24 Sep 2018 23:46:37 -0400 Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id 37AAC49433; Mon, 24 Sep 2018 23:42:20 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter03.heinlein-hosting.de (spamfilter03.heinlein-hosting.de [80.241.56.117]) (amavisd-new, port 10030) with ESMTP id Ba19ddQaHkyb; Mon, 24 Sep 2018 23:42:19 +0200 (CEST) From: Hauke Mehrtens To: johannes@sipsolutions.net Cc: backports@vger.kernel.org, Hauke Mehrtens Subject: [PATCH] backports: Add 3. parameter to of_dma_configure() Date: Mon, 24 Sep 2018 23:42:03 +0200 Message-Id: <20180924214203.26553-1-hauke@hauke-m.de> Sender: backports-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: backports@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP With commit 3d6ce86ee794 ("drivers: remove force dma flag from buses") in kernel 4.18 of_dma_configure() got the extra parameter force_dma. This is backported by setting the force_dma member which was added in commit d89e2378a97f ("drivers: flag buses which demand DMA configuration") in kernel 4.15. In older kernel versions we just ignore this parameter as the of_dma_configure() function internally takes care of setting this correctly. Since commit 7b07cbefb68d ("iommu: of: Handle IOMMU lookup failure with deferred probing or error") in kernel 4.12 this function returns int and not void any more. Signed-off-by: Hauke Mehrtens --- backport/backport-include/linux/of_device.h | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/backport/backport-include/linux/of_device.h b/backport/backport-include/linux/of_device.h index 951b2534..cdd366e3 100644 --- a/backport/backport-include/linux/of_device.h +++ b/backport/backport-include/linux/of_device.h @@ -3,9 +3,24 @@ #include_next #include -#if LINUX_VERSION_IS_LESS(4,1,0) -static inline void of_dma_configure(struct device *dev, struct device_node *np) -{} -#endif /* < 4.1.0 */ +#if LINUX_VERSION_IS_LESS(4,18,0) +static inline int backport_of_dma_configure(struct device *dev, + struct device_node *np, + bool force_dma) +{ +#if LINUX_VERSION_IS_GEQ(4,15,0) + dev->bus->force_dma = force_dma; + return of_dma_configure(dev, np); +#elif LINUX_VERSION_IS_GEQ(4,12,0) + return of_dma_configure(dev, np); +#elif LINUX_VERSION_IS_GEQ(4,1,0) + of_dma_configure(dev, np); + return 0; +#else + return 0; +#endif +} +#define of_dma_configure LINUX_BACKPORT(of_dma_configure) +#endif /* < 4.18 */ #endif /* __BP_OF_DEVICE_H */