Skip to content

Commit 48032c0

Browse files
Xingui Yangmartinkpetersen
authored andcommitted
scsi: libsas: Move sas_add_parent_port() to sas_expander.c
Move sas_add_parent_port() to sas_expander.c and rename it to sas_ex_add_parent_port() as it is only used in this file. Signed-off-by: Xingui Yang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: John Garry <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 888ea1b commit 48032c0

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

drivers/scsi/libsas/sas_expander.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@ static void sas_port_add_ex_phy(struct sas_port *port, struct ex_phy *ex_phy)
3333
ex_phy->phy_state = PHY_DEVICE_DISCOVERED;
3434
}
3535

36+
static void sas_ex_add_parent_port(struct domain_device *dev, int phy_id)
37+
{
38+
struct expander_device *ex = &dev->ex_dev;
39+
struct ex_phy *ex_phy = &ex->ex_phy[phy_id];
40+
41+
if (!ex->parent_port) {
42+
ex->parent_port = sas_port_alloc(&dev->rphy->dev, phy_id);
43+
/* FIXME: error handling */
44+
BUG_ON(!ex->parent_port);
45+
BUG_ON(sas_port_add(ex->parent_port));
46+
sas_port_mark_backlink(ex->parent_port);
47+
}
48+
sas_port_add_phy(ex->parent_port, ex_phy->phy);
49+
}
50+
3651
/* ---------- SMP task management ---------- */
3752

3853
/* Give it some long enough timeout. In seconds. */
@@ -968,11 +983,11 @@ static int sas_ex_discover_dev(struct domain_device *dev, int phy_id)
968983

969984
/* Parent and domain coherency */
970985
if (!dev->parent && sas_phy_match_port_addr(dev->port, ex_phy)) {
971-
sas_add_parent_port(dev, phy_id);
986+
sas_ex_add_parent_port(dev, phy_id);
972987
return 0;
973988
}
974989
if (dev->parent && sas_phy_match_dev_addr(dev->parent, ex_phy)) {
975-
sas_add_parent_port(dev, phy_id);
990+
sas_ex_add_parent_port(dev, phy_id);
976991
if (ex_phy->routing_attr == TABLE_ROUTING)
977992
sas_configure_phy(dev, phy_id, dev->port->sas_addr, 1);
978993
return 0;

drivers/scsi/libsas/sas_internal.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -189,21 +189,6 @@ static inline void sas_phy_set_target(struct asd_sas_phy *p, struct domain_devic
189189
}
190190
}
191191

192-
static inline void sas_add_parent_port(struct domain_device *dev, int phy_id)
193-
{
194-
struct expander_device *ex = &dev->ex_dev;
195-
struct ex_phy *ex_phy = &ex->ex_phy[phy_id];
196-
197-
if (!ex->parent_port) {
198-
ex->parent_port = sas_port_alloc(&dev->rphy->dev, phy_id);
199-
/* FIXME: error handling */
200-
BUG_ON(!ex->parent_port);
201-
BUG_ON(sas_port_add(ex->parent_port));
202-
sas_port_mark_backlink(ex->parent_port);
203-
}
204-
sas_port_add_phy(ex->parent_port, ex_phy->phy);
205-
}
206-
207192
static inline struct domain_device *sas_alloc_device(void)
208193
{
209194
struct domain_device *dev = kzalloc(sizeof(*dev), GFP_KERNEL);

0 commit comments

Comments
 (0)