diff mbox series

ntb_hw_switchtec: make ntb_mw_set_trans() work when addr == 0

Message ID 20190716173448.eswemneatvjwnxny@yadro.com (mailing list archive)
State Mainlined, archived
Commit c16c6655605f52cf2107a7c8dc0c798645351976
Headers show
Series ntb_hw_switchtec: make ntb_mw_set_trans() work when addr == 0 | expand

Commit Message

Alexander Fomichev July 16, 2019, 5:34 p.m. UTC
On switchtec_ntb_mw_set_trans() call, when (only) address == 0, it acts as
ntb_mw_clear_trans(). Fix this, since address == 0 and size != 0 is valid
combination for setting translation.

Signed-off-by: Alexander Fomichev <fomichev.ru@gmail.com>
---
 drivers/ntb/hw/mscc/ntb_hw_switchtec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Logan Gunthorpe July 16, 2019, 5:41 p.m. UTC | #1
On 2019-07-16 11:34 a.m., Alexander Fomichev wrote:
> On switchtec_ntb_mw_set_trans() call, when (only) address == 0, it acts as
> ntb_mw_clear_trans(). Fix this, since address == 0 and size != 0 is valid
> combination for setting translation.
> 
> Signed-off-by: Alexander Fomichev <fomichev.ru@gmail.com>

Looks good, thanks.

Reviewed-by: Logan Gunthorpe <logang@deltatee.com>

> ---
>  drivers/ntb/hw/mscc/ntb_hw_switchtec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c
> index db49677..45b9513 100644
> --- a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c
> +++ b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c
> @@ -305,7 +305,7 @@ static int switchtec_ntb_mw_set_trans(struct ntb_dev *ntb, int pidx, int widx,
>  	if (rc)
>  		return rc;
>  
> -	if (addr == 0 || size == 0) {
> +	if (size == 0) {
>  		if (widx < nr_direct_mw)
>  			switchtec_ntb_mw_clr_direct(sndev, widx);
>  		else
>
Jon Mason Sept. 10, 2019, 4:41 p.m. UTC | #2
On Tue, Jul 16, 2019 at 6:41 PM Logan Gunthorpe <logang@deltatee.com> wrote:
>
>
>
> On 2019-07-16 11:34 a.m., Alexander Fomichev wrote:
> > On switchtec_ntb_mw_set_trans() call, when (only) address == 0, it acts as
> > ntb_mw_clear_trans(). Fix this, since address == 0 and size != 0 is valid
> > combination for setting translation.
> >
> > Signed-off-by: Alexander Fomichev <fomichev.ru@gmail.com>
>
> Looks good, thanks.
>
> Reviewed-by: Logan Gunthorpe <logang@deltatee.com>

Applied to ntb-next, thanks

>
> > ---
> >  drivers/ntb/hw/mscc/ntb_hw_switchtec.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c
> > index db49677..45b9513 100644
> > --- a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c
> > +++ b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c
> > @@ -305,7 +305,7 @@ static int switchtec_ntb_mw_set_trans(struct ntb_dev *ntb, int pidx, int widx,
> >       if (rc)
> >               return rc;
> >
> > -     if (addr == 0 || size == 0) {
> > +     if (size == 0) {
> >               if (widx < nr_direct_mw)
> >                       switchtec_ntb_mw_clr_direct(sndev, widx);
> >               else
> >
diff mbox series

Patch

diff --git a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c
index db49677..45b9513 100644
--- a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c
+++ b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c
@@ -305,7 +305,7 @@  static int switchtec_ntb_mw_set_trans(struct ntb_dev *ntb, int pidx, int widx,
 	if (rc)
 		return rc;
 
-	if (addr == 0 || size == 0) {
+	if (size == 0) {
 		if (widx < nr_direct_mw)
 			switchtec_ntb_mw_clr_direct(sndev, widx);
 		else