diff options
Diffstat (limited to 'arch/sparc/kernel/ldc.c')
-rw-r--r-- | arch/sparc/kernel/ldc.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/arch/sparc/kernel/ldc.c b/arch/sparc/kernel/ldc.c index 66dacd56bb10..27bb55485472 100644 --- a/arch/sparc/kernel/ldc.c +++ b/arch/sparc/kernel/ldc.c | |||
@@ -1078,7 +1078,8 @@ static void ldc_iommu_release(struct ldc_channel *lp) | |||
1078 | 1078 | ||
1079 | struct ldc_channel *ldc_alloc(unsigned long id, | 1079 | struct ldc_channel *ldc_alloc(unsigned long id, |
1080 | const struct ldc_channel_config *cfgp, | 1080 | const struct ldc_channel_config *cfgp, |
1081 | void *event_arg) | 1081 | void *event_arg, |
1082 | const char *name) | ||
1082 | { | 1083 | { |
1083 | struct ldc_channel *lp; | 1084 | struct ldc_channel *lp; |
1084 | const struct ldc_mode_ops *mops; | 1085 | const struct ldc_mode_ops *mops; |
@@ -1093,6 +1094,8 @@ struct ldc_channel *ldc_alloc(unsigned long id, | |||
1093 | err = -EINVAL; | 1094 | err = -EINVAL; |
1094 | if (!cfgp) | 1095 | if (!cfgp) |
1095 | goto out_err; | 1096 | goto out_err; |
1097 | if (!name) | ||
1098 | goto out_err; | ||
1096 | 1099 | ||
1097 | switch (cfgp->mode) { | 1100 | switch (cfgp->mode) { |
1098 | case LDC_MODE_RAW: | 1101 | case LDC_MODE_RAW: |
@@ -1185,6 +1188,21 @@ struct ldc_channel *ldc_alloc(unsigned long id, | |||
1185 | 1188 | ||
1186 | INIT_HLIST_HEAD(&lp->mh_list); | 1189 | INIT_HLIST_HEAD(&lp->mh_list); |
1187 | 1190 | ||
1191 | snprintf(lp->rx_irq_name, LDC_IRQ_NAME_MAX, "%s RX", name); | ||
1192 | snprintf(lp->tx_irq_name, LDC_IRQ_NAME_MAX, "%s TX", name); | ||
1193 | |||
1194 | err = request_irq(lp->cfg.rx_irq, ldc_rx, 0, | ||
1195 | lp->rx_irq_name, lp); | ||
1196 | if (err) | ||
1197 | goto out_free_txq; | ||
1198 | |||
1199 | err = request_irq(lp->cfg.tx_irq, ldc_tx, 0, | ||
1200 | lp->tx_irq_name, lp); | ||
1201 | if (err) { | ||
1202 | free_irq(lp->cfg.rx_irq, lp); | ||
1203 | goto out_free_txq; | ||
1204 | } | ||
1205 | |||
1188 | return lp; | 1206 | return lp; |
1189 | 1207 | ||
1190 | out_free_txq: | 1208 | out_free_txq: |
@@ -1237,31 +1255,14 @@ EXPORT_SYMBOL(ldc_free); | |||
1237 | * state. This does not initiate a handshake, ldc_connect() does | 1255 | * state. This does not initiate a handshake, ldc_connect() does |
1238 | * that. | 1256 | * that. |
1239 | */ | 1257 | */ |
1240 | int ldc_bind(struct ldc_channel *lp, const char *name) | 1258 | int ldc_bind(struct ldc_channel *lp) |
1241 | { | 1259 | { |
1242 | unsigned long hv_err, flags; | 1260 | unsigned long hv_err, flags; |
1243 | int err = -EINVAL; | 1261 | int err = -EINVAL; |
1244 | 1262 | ||
1245 | if (!name || | 1263 | if (lp->state != LDC_STATE_INIT) |
1246 | (lp->state != LDC_STATE_INIT)) | ||
1247 | return -EINVAL; | 1264 | return -EINVAL; |
1248 | 1265 | ||
1249 | snprintf(lp->rx_irq_name, LDC_IRQ_NAME_MAX, "%s RX", name); | ||
1250 | snprintf(lp->tx_irq_name, LDC_IRQ_NAME_MAX, "%s TX", name); | ||
1251 | |||
1252 | err = request_irq(lp->cfg.rx_irq, ldc_rx, 0, | ||
1253 | lp->rx_irq_name, lp); | ||
1254 | if (err) | ||
1255 | return err; | ||
1256 | |||
1257 | err = request_irq(lp->cfg.tx_irq, ldc_tx, 0, | ||
1258 | lp->tx_irq_name, lp); | ||
1259 | if (err) { | ||
1260 | free_irq(lp->cfg.rx_irq, lp); | ||
1261 | return err; | ||
1262 | } | ||
1263 | |||
1264 | |||
1265 | spin_lock_irqsave(&lp->lock, flags); | 1266 | spin_lock_irqsave(&lp->lock, flags); |
1266 | 1267 | ||
1267 | enable_irq(lp->cfg.rx_irq); | 1268 | enable_irq(lp->cfg.rx_irq); |