Skip to content

Commit afc5499

Browse files
Allen Hubbejonmason
authored andcommitted
NTB: Make _addr functions optional in the API
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>
1 parent 838850e commit afc5499

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

include/linux/ntb.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ static inline int ntb_dev_ops_is_valid(const struct ntb_dev_ops *ops)
284284
/* ops->db_read_mask && */
285285
ops->db_set_mask &&
286286
ops->db_clear_mask &&
287-
ops->peer_db_addr &&
287+
/* ops->peer_db_addr && */
288288
/* ops->peer_db_read && */
289289
ops->peer_db_set &&
290290
/* ops->peer_db_clear && */
@@ -295,7 +295,7 @@ static inline int ntb_dev_ops_is_valid(const struct ntb_dev_ops *ops)
295295
ops->spad_count &&
296296
ops->spad_read &&
297297
ops->spad_write &&
298-
ops->peer_spad_addr &&
298+
/* ops->peer_spad_addr && */
299299
/* ops->peer_spad_read && */
300300
ops->peer_spad_write &&
301301
1;
@@ -757,6 +757,9 @@ static inline int ntb_peer_db_addr(struct ntb_dev *ntb,
757757
phys_addr_t *db_addr,
758758
resource_size_t *db_size)
759759
{
760+
if (!ntb->ops->peer_db_addr)
761+
return -EINVAL;
762+
760763
return ntb->ops->peer_db_addr(ntb, db_addr, db_size);
761764
}
762765

@@ -948,6 +951,9 @@ static inline int ntb_spad_write(struct ntb_dev *ntb, int idx, u32 val)
948951
static inline int ntb_peer_spad_addr(struct ntb_dev *ntb, int idx,
949952
phys_addr_t *spad_addr)
950953
{
954+
if (!ntb->ops->peer_spad_addr)
955+
return -EINVAL;
956+
951957
return ntb->ops->peer_spad_addr(ntb, idx, spad_addr);
952958
}
953959

0 commit comments

Comments
 (0)