parisc/dino: use container_of in DINO_DEV
authorChristoph Hellwig <hch@lst.de>
Tue, 29 Jan 2019 18:13:08 +0000 (19:13 +0100)
committerHelge Deller <deller@gmx.de>
Thu, 21 Feb 2019 19:37:12 +0000 (20:37 +0100)
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>
Signed-off-by: Helge Deller <deller@gmx.de>
drivers/parisc/dino.c

index 6f348c7..846b59d 100644 (file)
@@ -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