]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/ufs/util.h
[PATCH] lpfc 8.1.3: Remove unused MBhostaddr from lpfc_sli structure
[linux-2.6-omap-h63xx.git] / fs / ufs / util.h
index e45ad53798722afe9885f779c3a31f06e95577df..48d6d9bcc15770ce05cd8a8c8bb08e3e5f88e26e 100644 (file)
@@ -249,18 +249,28 @@ extern void _ubh_memcpyubh_(struct ufs_sb_private_info *, struct ufs_buffer_head
 
 
 /*
- * macros to get important structures from ufs_buffer_head
+ * macros and inline function to get important structures from ufs_sb_private_info
  */
-#define ubh_get_usb_first(ubh) \
-       ((struct ufs_super_block_first *)((ubh)->bh[0]->b_data))
 
-#define ubh_get_usb_second(ubh) \
-       ((struct ufs_super_block_second *)((ubh)->\
-       bh[UFS_SECTOR_SIZE >> uspi->s_fshift]->b_data + (UFS_SECTOR_SIZE & ~uspi->s_fmask)))
+static inline void *get_usb_offset(struct ufs_sb_private_info *uspi,
+                                  unsigned int offset)
+{
+       unsigned int index;
+       
+       index = offset >> uspi->s_fshift;
+       offset &= ~uspi->s_fmask;
+       return uspi->s_ubh.bh[index]->b_data + offset;
+}
+
+#define ubh_get_usb_first(uspi) \
+       ((struct ufs_super_block_first *)get_usb_offset((uspi), 0))
+
+#define ubh_get_usb_second(uspi) \
+       ((struct ufs_super_block_second *)get_usb_offset((uspi), UFS_SECTOR_SIZE))
+
+#define ubh_get_usb_third(uspi)        \
+       ((struct ufs_super_block_third *)get_usb_offset((uspi), 2*UFS_SECTOR_SIZE))
 
-#define ubh_get_usb_third(ubh) \
-       ((struct ufs_super_block_third *)((ubh)-> \
-       bh[UFS_SECTOR_SIZE*2 >> uspi->s_fshift]->b_data + (UFS_SECTOR_SIZE*2 & ~uspi->s_fmask)))
 
 #define ubh_get_ucg(ubh) \
        ((struct ufs_cylinder_group *)((ubh)->bh[0]->b_data))