linux-parisc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: "James E.J. Bottomley" <jejb@parisc-linux.org>,
	Helge Deller <deller@gmx.de>
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	[thread overview]
Message-ID: <20190114112353.30616-7-hch@lst.de> (raw)
In-Reply-To: <20190114112353.30616-1-hch@lst.de>

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 <hch@lst.de>
---
 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
-- 
2.20.1


  parent reply	other threads:[~2019-01-14 11:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-14 11:23 DMA-related cleanups for parisc Christoph Hellwig
2019-01-14 11:23 ` [PATCH 1/8] parisc: don't include <asm/cacheflush.h> in <asm/dma-mapping.h> Christoph Hellwig
2019-01-14 11:23 ` [PATCH 2/8] parisc: move internal implementation details out of <asm/dma-mapping.h> Christoph Hellwig
2019-01-14 11:23 ` [PATCH 3/8] parisc: turn GET_IOC into an inline function Christoph Hellwig
2019-01-14 23:32   ` kbuild test robot
2019-01-14 11:23 ` [PATCH 4/8] parisc: properly type the iommu field in struct pci_hba_data Christoph Hellwig
2019-01-14 11:23 ` [PATCH 5/8] parisc: properly type the return value of parisc_walk_tree Christoph Hellwig
2019-01-14 11:23 ` Christoph Hellwig [this message]
2019-01-14 11:23 ` [PATCH 7/8] parisc/lba_pci: use container_of in LBA_DEV Christoph Hellwig
2019-01-14 11:23 ` [PATCH 8/8] parisc: remove the HBA_DATA macro Christoph Hellwig
2019-01-26 17:11 ` DMA-related cleanups for parisc Helge Deller
2019-01-28  7:34   ` Christoph Hellwig
2019-01-29 18:06     ` Helge Deller
2019-01-29 18:12       ` Christoph Hellwig
2019-01-29 18:13 DMA-related cleanups for parisc v2 Christoph Hellwig
2019-01-29 18:13 ` [PATCH 6/8] parisc/dino: use container_of in DINO_DEV Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190114112353.30616-7-hch@lst.de \
    --to=hch@lst.de \
    --cc=deller@gmx.de \
    --cc=jejb@parisc-linux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).