Skip to content

Commit

Permalink
NTB: Make _addr functions optional in the API
Browse files Browse the repository at this point in the history
The functions ntb_peer_db_addr and ntb_peer_spad_addr were required by
the api.  The functions already support returning an error, so any
existing calling code should already check for it.  Any existing code
using drivers that implement the functions will not be affected.

Signed-off-by: Allen Hubbe <Allen.Hubbe@emc.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
  • Loading branch information
Allen Hubbe authored and Jon Mason committed Mar 21, 2016
1 parent 838850e commit afc5499
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions include/linux/ntb.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ static inline int ntb_dev_ops_is_valid(const struct ntb_dev_ops *ops)
/* ops->db_read_mask && */
ops->db_set_mask &&
ops->db_clear_mask &&
ops->peer_db_addr &&
/* ops->peer_db_addr && */
/* ops->peer_db_read && */
ops->peer_db_set &&
/* ops->peer_db_clear && */
Expand All @@ -295,7 +295,7 @@ static inline int ntb_dev_ops_is_valid(const struct ntb_dev_ops *ops)
ops->spad_count &&
ops->spad_read &&
ops->spad_write &&
ops->peer_spad_addr &&
/* ops->peer_spad_addr && */
/* ops->peer_spad_read && */
ops->peer_spad_write &&
1;
Expand Down Expand Up @@ -757,6 +757,9 @@ static inline int ntb_peer_db_addr(struct ntb_dev *ntb,
phys_addr_t *db_addr,
resource_size_t *db_size)
{
if (!ntb->ops->peer_db_addr)
return -EINVAL;

return ntb->ops->peer_db_addr(ntb, db_addr, db_size);
}

Expand Down Expand Up @@ -948,6 +951,9 @@ static inline int ntb_spad_write(struct ntb_dev *ntb, int idx, u32 val)
static inline int ntb_peer_spad_addr(struct ntb_dev *ntb, int idx,
phys_addr_t *spad_addr)
{
if (!ntb->ops->peer_spad_addr)
return -EINVAL;

return ntb->ops->peer_spad_addr(ntb, idx, spad_addr);
}

Expand Down

0 comments on commit afc5499

Please sign in to comment.