From patchwork Wed May 13 09:44:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 225993 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F4167CA90AF for ; Wed, 13 May 2020 09:54:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CD45223127 for ; Wed, 13 May 2020 09:54:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589363675; bh=Sh7DwfrfOJhgpZljqzpzIQzvgSzRfrhZh3U8H3IvUWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=1fdICkEijCaI2n4lQt5MXJY15gloU+M0666k0qQIVrlXgcCFJZX9C9QJNyy9h30LV 6BgSm6dKJmQlGiFT5TeamM+7u8l2M7xuQ8rnV9p9K6+PkDK2Rbdw9KPr7L583UHk8b GWIa/gBfxJ5YvURYNZWq9C92QepZQAGPvIOeP2eA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388087AbgEMJy1 (ORCPT ); Wed, 13 May 2020 05:54:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:56850 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388094AbgEMJy0 (ORCPT ); Wed, 13 May 2020 05:54:26 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7243B20769; Wed, 13 May 2020 09:54:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589363665; bh=Sh7DwfrfOJhgpZljqzpzIQzvgSzRfrhZh3U8H3IvUWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gQxaVpDuDtyv5/v5MNWE1z8sTSRBHG3RENqQQehL47MXOZTHbEmauBcL26mvVE+16 OOV1XSKOlX1YzOaRxYceKwSw0flijjlzVjqZIIlk4ThQIJSBZ/ammGfAfXtHUpOIDd EGMI3vB5zctp0fXIQmQ+iH/xg2ShRM13es+0b5zY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Russell King , Haibo Chen , Arnd Bergmann , Ulf Hansson Subject: [PATCH 5.6 077/118] amba: Initialize dma_parms for amba devices Date: Wed, 13 May 2020 11:44:56 +0200 Message-Id: <20200513094424.342848300@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200513094417.618129545@linuxfoundation.org> References: <20200513094417.618129545@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ulf Hansson commit f458488425f1cc9a396aa1d09bb00c48783936da upstream. It's currently the amba driver's responsibility to initialize the pointer, dma_parms, for its corresponding struct device. The benefit with this approach allows us to avoid the initialization and to not waste memory for the struct device_dma_parameters, as this can be decided on a case by case basis. However, it has turned out that this approach is not very practical. Not only does it lead to open coding, but also to real errors. In principle callers of dma_set_max_seg_size() doesn't check the error code, but just assumes it succeeds. For these reasons, let's do the initialization from the common amba bus at the device registration point. This also follows the way the PCI devices are being managed, see pci_device_add(). Suggested-by: Christoph Hellwig Cc: Russell King Cc: Tested-by: Haibo Chen Reviewed-by: Arnd Bergmann Signed-off-by: Ulf Hansson Reviewed-by: Christoph Hellwig Link: https://lore.kernel.org/r/20200422101013.31267-1-ulf.hansson@linaro.org Signed-off-by: Greg Kroah-Hartman --- drivers/amba/bus.c | 1 + include/linux/amba/bus.h | 1 + 2 files changed, 2 insertions(+) --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c @@ -645,6 +645,7 @@ static void amba_device_initialize(struc dev->dev.release = amba_device_release; dev->dev.bus = &amba_bustype; dev->dev.dma_mask = &dev->dev.coherent_dma_mask; + dev->dev.dma_parms = &dev->dma_parms; dev->res.name = dev_name(&dev->dev); } --- a/include/linux/amba/bus.h +++ b/include/linux/amba/bus.h @@ -65,6 +65,7 @@ struct amba_device { struct device dev; struct resource res; struct clk *pclk; + struct device_dma_parameters dma_parms; unsigned int periphid; unsigned int cid; struct amba_cs_uci_id uci;