Skip to content

Commit 8ae3ceb

Browse files
Ben Widawskydjbw
authored andcommitted
cxl/core: Use is_endpoint_decoder
Save some characters and directly check decoder type rather than port type. There's no need to check if the port is an endpoint port since, by this point, cxl_endpoint_decoder_alloc() has a specified type. Reviewed by: Adam Manzanares <[email protected]> Signed-off-by: Ben Widawsky <[email protected]> Signed-off-by: Dan Williams <[email protected]>
1 parent db9a3a3 commit 8ae3ceb

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

drivers/cxl/core/hdm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ static int init_hdm_decoder(struct cxl_port *port, struct cxl_decoder *cxld,
197197
else
198198
cxld->target_type = CXL_DECODER_ACCELERATOR;
199199

200-
if (is_cxl_endpoint(to_cxl_port(cxld->dev.parent)))
200+
if (is_endpoint_decoder(&cxld->dev))
201201
return 0;
202202

203203
target_list.value =

drivers/cxl/core/port.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ static const struct device_type cxl_decoder_root_type = {
272272
.groups = cxl_decoder_root_attribute_groups,
273273
};
274274

275-
static bool is_endpoint_decoder(struct device *dev)
275+
bool is_endpoint_decoder(struct device *dev)
276276
{
277277
return dev->type == &cxl_decoder_endpoint_type;
278278
}

drivers/cxl/cxl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ struct cxl_dport *cxl_find_dport_by_dev(struct cxl_port *port,
340340

341341
struct cxl_decoder *to_cxl_decoder(struct device *dev);
342342
bool is_root_decoder(struct device *dev);
343+
bool is_endpoint_decoder(struct device *dev);
343344
bool is_cxl_decoder(struct device *dev);
344345
struct cxl_decoder *cxl_root_decoder_alloc(struct cxl_port *port,
345346
unsigned int nr_targets);

0 commit comments

Comments
 (0)