return dr->attached_dev_type;
 }
 
-static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp)
+static void sas_set_ex_phy(struct domain_device *dev, int phy_id,
+                          struct smp_disc_resp *disc_resp)
 {
        enum sas_device_type dev_type;
        enum sas_linkrate linkrate;
        u8 sas_addr[SAS_ADDR_SIZE];
-       struct smp_resp *resp = rsp;
-       struct discover_resp *dr = &resp->disc;
+       struct discover_resp *dr = &disc_resp->disc;
        struct sas_ha_struct *ha = dev->port->ha;
        struct expander_device *ex = &dev->ex_dev;
        struct ex_phy *phy = &ex->ex_phy[phy_id];
                BUG_ON(!phy->phy);
        }
 
-       switch (resp->result) {
+       switch (disc_resp->result) {
        case SMP_RESP_PHY_VACANT:
                phy->phy_state = PHY_VACANT;
                break;
 }
 
 #define DISCOVER_REQ_SIZE  16
-#define DISCOVER_RESP_SIZE 56
+#define DISCOVER_RESP_SIZE sizeof(struct smp_disc_resp)
 
 static int sas_ex_phy_discover_helper(struct domain_device *dev, u8 *disc_req,
-                                     u8 *disc_resp, int single)
+                                     struct smp_disc_resp *disc_resp,
+                                     int single)
 {
-       struct discover_resp *dr;
+       struct discover_resp *dr = &disc_resp->disc;
        int res;
 
        disc_req[9] = single;
                               disc_resp, DISCOVER_RESP_SIZE);
        if (res)
                return res;
-       dr = &((struct smp_resp *)disc_resp)->disc;
        if (memcmp(dev->sas_addr, dr->attached_sas_addr, SAS_ADDR_SIZE) == 0) {
                pr_notice("Found loopback topology, just ignore it!\n");
                return 0;
        struct expander_device *ex = &dev->ex_dev;
        int  res = 0;
        u8   *disc_req;
-       u8   *disc_resp;
+       struct smp_disc_resp *disc_resp;
 
        disc_req = alloc_smp_req(DISCOVER_REQ_SIZE);
        if (!disc_req)
 /* ---------- Domain revalidation ---------- */
 
 static int sas_get_phy_discover(struct domain_device *dev,
-                               int phy_id, struct smp_resp *disc_resp)
+                               int phy_id, struct smp_disc_resp *disc_resp)
 {
        int res;
        u8 *disc_req;
                               disc_resp, DISCOVER_RESP_SIZE);
        if (res)
                goto out;
-       else if (disc_resp->result != SMP_RESP_FUNC_ACC) {
+       if (disc_resp->result != SMP_RESP_FUNC_ACC)
                res = disc_resp->result;
-               goto out;
-       }
 out:
        kfree(disc_req);
        return res;
                                    int phy_id, int *pcc)
 {
        int res;
-       struct smp_resp *disc_resp;
+       struct smp_disc_resp *disc_resp;
 
        disc_resp = alloc_smp_resp(DISCOVER_RESP_SIZE);
        if (!disc_resp)
                                    u8 *sas_addr, enum sas_device_type *type)
 {
        int res;
-       struct smp_resp *disc_resp;
-       struct discover_resp *dr;
+       struct smp_disc_resp *disc_resp;
 
        disc_resp = alloc_smp_resp(DISCOVER_RESP_SIZE);
        if (!disc_resp)
                return -ENOMEM;
-       dr = &disc_resp->disc;
 
        res = sas_get_phy_discover(dev, phy_id, disc_resp);
        if (res == 0) {
                memcpy(sas_addr, disc_resp->disc.attached_sas_addr,
                       SAS_ADDR_SIZE);
-               *type = to_dev_type(dr);
+               *type = to_dev_type(&disc_resp->disc);
                if (*type == 0)
                        memset(sas_addr, 0, SAS_ADDR_SIZE);
        }
 
        __be32 crc;
 } __attribute__ ((packed));
 
-struct smp_resp {
-       u8    frame_type;
-       u8    function;
-       u8    result;
-       u8    reserved;
-       union {
-               struct report_general_resp  rg;
-               struct discover_resp        disc;
-               struct report_phy_sata_resp rps;
-       };
-} __attribute__ ((packed));
-
 #elif defined(__BIG_ENDIAN_BITFIELD)
 struct sas_identify_frame {
        /* Byte 0 */
        __be32 crc;
 } __attribute__ ((packed));
 
+#else
+#error "Bitfield order not defined!"
+#endif
+
+struct smp_disc_resp {
+       u8    frame_type;
+       u8    function;
+       u8    result;
+       u8    reserved;
+       struct discover_resp disc;
+} __attribute__ ((packed));
+
 struct smp_resp {
        u8    frame_type;
        u8    function;
        };
 } __attribute__ ((packed));
 
-#else
-#error "Bitfield order not defined!"
-#endif
-
 #endif /* _SAS_H_ */