Received: by 10.192.165.148 with SMTP id m20csp1584920imm; Thu, 3 May 2018 01:49:23 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrEaLt0rYuyo9oiDyzwiTw6LIZDwL52t9bH085bGE3phGl0TMkWLRQZnm3G7fKMoab2qlp2 X-Received: by 2002:a65:4189:: with SMTP id a9-v6mr18462081pgq.118.1525337363349; Thu, 03 May 2018 01:49:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525337363; cv=none; d=google.com; s=arc-20160816; b=ieG8i1fEOd4h0ZEtaoAmFAihmJ5jqfOqP7Bqnz8L3Z39tUx3EI+hj1tQ1w9+T7yNNG 35q9mk+QkTgXgt2AX2felYp00ie9bHSLvmyfa0D4zh3NVMkqUZMFU70N0zvd5WtEZQ6E 76v3KpC95uOS1aMti7eHoxFxL/BbgKzhFQWy9tXsHWpP9MO8LoCcRJXc36b3cIYTNQz8 43JZrON4VUr/HX9yQ7zsgtdu12XYgZK+lViKWgGdKnX090tsv1wyU8yMq7ZiElZeE7Hk YO+DwTGu3bi6mvl2bl0DGi1NXkM3KlErzhTczjzgNTw3ZH3/pTB508ZMtOsQUPeJFnIr /P/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=6WCvImeNsS64PAQMF9nJbG6Xm3u/qM5Ox/DDSgkpiVo=; b=ca2/TdwCN0uE0xKmjAGvs/28QctqaismTEGaKlDsj7cxmPGe+JFlrY7ib9Zu8leGGC TpeH4fYIbKu9h/8/63im8ZRAUSA72ZAQL7FIKf7pLNjkVh/vbwSQoIE43U5ND+Qv2VsD 1ibP0CNjAtN5B+BKRPLksEG77MM6lPv4wa9MkJc9AygSquoI0+wT5bLFCSjuPasQAImC V76x5VcW5t7GOee5SIyO8IFtxN99KqkMUjQ1rOzPqrpG6AMY0JPukdu9pwgfdpD9JhOk obs0v3uL/1BEsLjpOmjfhg3e5/sjQNJei87/fgFsdvaBzZGsiuMPjxLLuJapeMYwrE1U wJNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=VmkUG+ww; 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 f64-v6si13647364plf.514.2018.05.03.01.49.09; Thu, 03 May 2018 01:49:23 -0700 (PDT) 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=VmkUG+ww; 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 S1751570AbeECIrB (ORCPT + 99 others); Thu, 3 May 2018 04:47:01 -0400 Received: from mail-ua0-f196.google.com ([209.85.217.196]:37647 "EHLO mail-ua0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751354AbeECIq5 (ORCPT ); Thu, 3 May 2018 04:46:57 -0400 Received: by mail-ua0-f196.google.com with SMTP id i3so11280946uad.4; Thu, 03 May 2018 01:46:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=6WCvImeNsS64PAQMF9nJbG6Xm3u/qM5Ox/DDSgkpiVo=; b=VmkUG+ww5xNAjOjg50D1nRk1Sr7uiCc4sfJUVk4XVtIGoPUfp78Vo7+JnxOpqOSKKz mH4TLa7ShyqmJ9asQr+Fzcu8H3Qjot8DEMxF7kTdupZC2AzgJp9A8TrhOvPJm1r6wqmk 4HYO/UlvBJAc0OSOiy5UOjAeJ0aGNPAUzs+dMVT4jDrcuP+ThYGGgWFCJ4KtpS6qP1M5 VlUeXSeDHDozAr0u+sPviZsQBhqSlaEc1Ql4+FfFqO3OcTRb2A4Pu2onAicJAS+FVX2t I+zo6tU6kWDoNhnTJuBMoh7VW0WXYjfFWvhxpNFA6DBHMllAtHdXZ6fwjHPb0PrusPFO qTnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=6WCvImeNsS64PAQMF9nJbG6Xm3u/qM5Ox/DDSgkpiVo=; b=VdwI9dcz9u9aNZvlq/jGFoMFuZg4CQNGVI5N6PDgrUSSU3dMhs4eglfJ67MFHBFaGf n59qi/TcUuBa4NLpaPs1xWXonBtXPkI2bvyYBdvQ48ju18K9CKpO8+YF41gdLNRx/Wh0 ARqTLgY6lGMIy0o1B66PjdpVx1HNYYCG9u5c0vYfg3FJD8BQcWeAmMDCO/zJ2lJu5Ji7 S+rGwkZmfKCHml58AZE7YPFLEBss4MejAzdQUKvC4Uq9V1wHv/Je6TYmocVmtxNU5JXg fiIiCRG5McvbmW3qtKWQ3nnI/QftWp1ZlYmyuwUjzp/koSHa/oyKk6FnDus+kIikIlRT vIzA== X-Gm-Message-State: ALQs6tBaX68tTlmxbOlKKd7bzyJU6DBTZ5Uhcy+Boyu/B1loQkztI2Py EhzmJK9LNVbIEMukljRzVbqQmfAqeXcTvLZpeGo= X-Received: by 10.176.81.6 with SMTP id e6mr22417275uaa.33.1525337216926; Thu, 03 May 2018 01:46:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.122.10 with HTTP; Thu, 3 May 2018 01:46:56 -0700 (PDT) In-Reply-To: References: From: Geert Uytterhoeven Date: Thu, 3 May 2018 10:46:56 +0200 X-Google-Sender-Auth: 27YmNKhHOf7vtTu7MIyof1hIDiA Message-ID: Subject: Re: [PATCH net] macmace: Set platform device coherent_dma_mask To: Finn Thain Cc: "David S. Miller" , linux-m68k , netdev , Linux Kernel Mailing List , Christoph Hellwig Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Finn, CC Christoph On Thu, May 3, 2018 at 10:38 AM, Finn Thain wrote: > On Thu, 3 May 2018, Geert Uytterhoeven wrote: >> > --- a/drivers/net/ethernet/apple/macmace.c >> > +++ b/drivers/net/ethernet/apple/macmace.c >> > @@ -203,6 +203,10 @@ static int mace_probe(struct platform_device *pdev) >> > unsigned char checksum = 0; >> > int err; >> > >> > + err = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); >> > + if (err) >> > + return err; >> > + >> > dev = alloc_etherdev(PRIV_BYTES); >> > if (!dev) >> > return -ENOMEM; >> >> Shouldn't this be handled in the platform code that instantiates the >> device, i.e. in arch/m68k/mac/config.c:mac_platform_init()? > > I wondered about that too. The downside is that I'd have to convert > platform_device_register_simple() into platform_device_register() and add > all of the boilerplate that goes with that, for little gain. > >> Cfr. commit f61e64310b75733d ("m68k: set dma and coherent masks for >> platform FEC ethernets"). > > Yes, I looked at that patch before I sent this one. It makes sense to set > the mask when defining the device since some devices tend to have inherent > limitations (but that's not really applicable here). > > Moreover, it turns out that a number of platform drivers already call > dma_set_mask_and_coherent() or dma_coerce_mask_and_coherent() or similar. > > I figured that platform drivers aren't expected to be particularly > portable. Well, I'd expect macmace and macsonic to be portable to NuBus > PowerMacs, but AFAIK the correct mask would remain DMA_BIT_MASK(32). > > So that's how I ended up with this patch. But if you are not pursuaded by > my reasoning then just say the word and I'll take another approach. Perhaps you can add a new helper (platform_device_register_simple_dma()?) that takes the DMA mask, too? With people setting the mask to kill the WARNING splat, this may become more common. struct platform_device_info already has a dma_mask field, but platform_device_register_resndata() explicitly sets it to zero. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds