From patchwork Mon Jan 14 11:23:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10762231 X-Patchwork-Delegate: deller@gmx.de 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 9912A1390 for ; Mon, 14 Jan 2019 11:24:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89F74286A9 for ; Mon, 14 Jan 2019 11:24:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E81F28821; Mon, 14 Jan 2019 11:24:33 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 342E5286A9 for ; Mon, 14 Jan 2019 11:24:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726770AbfANLYP (ORCPT ); Mon, 14 Jan 2019 06:24:15 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:38612 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726743AbfANLYO (ORCPT ); Mon, 14 Jan 2019 06:24:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=GSD9JLapBWqIj3ABdywFRH0m0lA8Ni+ahzMil/WnITY=; b=YQE73UDb8Y0GMPdlkC7x2EAgxO S1vtF+JlOotjnAP06srMWRFXHs8vFG7uSJpMX1LjCkwg77k2cxzKqRrcQkj5sJc/19RxW90t9rdoa vsYc1UgNsvMXUrZCpI5ge1MhbKmFbJc06LYAL/4m8qJAyq26fGyEnaelb9zOfQN4g6BGIwmsuQE8o bALXov3Zg8Uyqc01P3sL+An5tkLGXrdQEZIFuYCtVhWoUyynLNEKpN/8IEduCrq+X7cLlFBmXuoZR e3p/i65bT8JRssB278EjPgsPeolwCZVgU6x1SjZyLHYhvvGzKHQvRbHFlXpg6uPfVX1UBRnzvDHwv NsqOHiqw==; Received: from 089144213167.atnat0022.highway.a1.net ([89.144.213.167] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gj0Ll-0006pc-9X; Mon, 14 Jan 2019 11:24:13 +0000 From: Christoph Hellwig To: "James E.J. Bottomley" , Helge Deller Cc: linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/8] parisc/dino: use container_of in DINO_DEV Date: Mon, 14 Jan 2019 12:23:51 +0100 Message-Id: <20190114112353.30616-7-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190114112353.30616-1-hch@lst.de> References: <20190114112353.30616-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use the type safe container_of macros instead of a blind cast in DINO_DEV, and turn the macro into an inline function. Signed-off-by: Christoph Hellwig --- drivers/parisc/dino.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c index 6f348c75687c..846b59d15999 100644 --- a/drivers/parisc/dino.c +++ b/drivers/parisc/dino.c @@ -154,12 +154,10 @@ struct dino_device #endif }; -/* Looks nice and keeps the compiler happy */ -#define DINO_DEV(d) ({ \ - void *__pdata = d; \ - BUG_ON(!__pdata); \ - (struct dino_device *)__pdata; }) - +static inline struct dino_device *DINO_DEV(struct pci_hba_data *hba) +{ + return container_of(hba, struct dino_device, hba); +} /* * Dino Configuration Space Accessor Functions