Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4401046pxv; Tue, 29 Jun 2021 06:17:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwU9+0arLxeMlccETdFe3TnadEUDuD5q2Ca+pgCw7OzSNEurQdQar1PP85Ua3ZzKlu7UWmQ X-Received: by 2002:a6b:7901:: with SMTP id i1mr3890695iop.41.1624972636402; Tue, 29 Jun 2021 06:17:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624972636; cv=none; d=google.com; s=arc-20160816; b=nWxn2oW6o5zytZdnbQ+qoHiSbIp/yBUBRDe3hLu/44bWcCZBW+lcm4OPuReKLoPOIo LSo25uwV3HcSeYAj1FxwyKUXhBe0aH85evQX/X4OOWeIF1PS1KDpwTjA0thZYNTQR0KT RyfvRcp1HM7+iYXAIIMIcK5XYuctIn24aJwbApH7P/RpH5NbXwDEkYsk8qGoZVzv9WLb pfBgim0oxcF/92p2YOQjmj7/WDsBa/XNix4sXHtV0jX8HyrB+ungG+uMXotqVqirScxl PQWd7dgjxiWBLWcgxkCFB6daTJB0FQvTuI47u/NCQvZcjs0U9DNNhstoIHzT7XbfPB94 q5WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=cQiMhuwcCnWPXZMR9TYhujtLr9UaxQf5XLLU8CvjfBQ=; b=acpPcYMwYIamnBwyF+G5dsMmmUmgWpRauose0FeeegNF5xagkXwuPlr774Gn8nAqM4 16Izb0DbTDSrYGG47YP0mfF5UbHpEzwKGKNoNGbl2T1NfAYQk2Y7ZIQ/1oYZcJe1SFtB +J5vM2ubHqaOXknASBQg1p+LKc5nXDUF6THl+eeSZOObbrCY5FMzDhC6LiIp+hxKBCrz puonz2AdA4TBypeISwwF8d3stJrgw1Q50NeO+yCKB/GpgPEBtmbagLj7zvD+4JYHfYNs AqJYF/JkaEqEGD68Q/jkMhmx7YB25wmIrNg7/vyzTibacChw3NTCXRvCDg3fiEHvUZSI d24g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nFfFr5uQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e3si18464253iom.57.2021.06.29.06.17.03; Tue, 29 Jun 2021 06:17:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nFfFr5uQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233056AbhF2NRV (ORCPT + 99 others); Tue, 29 Jun 2021 09:17:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:52604 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232487AbhF2NRU (ORCPT ); Tue, 29 Jun 2021 09:17:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4EF2B61D5D; Tue, 29 Jun 2021 13:14:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1624972493; bh=DO025SKb+VEs0Eqlb7EEbyLJkhVsdGH2nOLagnB7ls4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nFfFr5uQSgSl4CHUmb6b0zI3skWp2FFGTuWEnLkGwm/7cgCgMPUT+1QPJH2G8pWjX F+dXre2v7J8EU9JhQzU5o6lhV7Fuz8zs1YPwPevJH1bQ0lHUhbKZDSvWCvkATOBGwB 9H60pQLVmyxpz1vScjk7NUds80FuykyjKQ9Rn1cI= Date: Tue, 29 Jun 2021 15:14:51 +0200 From: Greg KH To: Bing Fan Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] arm pl011 serial: support multi-irq request Message-ID: References: <1624930164-18411-1-git-send-email-hptsfb@gmail.com> <8e3133f8-a528-70fb-d539-9508a6cdcd3a@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <8e3133f8-a528-70fb-d539-9508a6cdcd3a@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 29, 2021 at 08:31:00PM +0800, Bing Fan wrote: > hello, > > > 在 6/29/2021 20:18, Greg KH 写道: > > On Tue, Jun 29, 2021 at 07:32:36PM +0800, Bing Fan wrote: > > > hello, replied as below. and new patch is at the bottom. > > Please submit this properly as the documentation says to do so, I can't > > take an attachment :( > Ok. > > > > > + struct amba_device *amba_dev = (struct amba_device *)uap->port.dev; > > > > Are you sure you can just cast this like this? Did you test this? > > > Yes, i have tested and applied in my project. The function > > > pl011_probe calls pl011_setup_port with &amba_dev->dev and uap > > > params; and pl011_setup_port set uap->port.dev to the address of > > > amba_dev->dev; the two structs' relationship is:     struct > > > amba_device {         struct device dev;         ……     }; When > > > pointer(uap->port.dev) points to amba_dev->dev address, the momery > > > actully stores content of struct amba_device; so the cast assignment > > > can be forced to amba_dev. > > That is now how this should work, use the correct container_of() cast > > instead. That will always work no matter where struct device is in the > > structure. You got lucky here :) > > changed to "struct amba_device *amba_dev = container_of(uap->port.dev, struct amba_device, dev);" > > > > > > > + + if (!amba_dev) + return -1; > > > > Do not make up error numbers, return a specific -ERR* value. > > > changed to "return -ENODEV" > > So this changed the logic of this function, is that ok? > > No, just sanity check. If it can never happen, no need to check for it. > > > > And how can this happen? > > > The function pl011_setup_port isn't called, event pl011_probe isn't > > > called. > > And how can that ever happen? > > If there is no pl011 device. How can that happen here? thanks, greg k-h