Skip to content

Commit

Permalink
Make sure a device node path override is used in messages.
Browse files Browse the repository at this point in the history
Update comments.
  • Loading branch information
BsAtHome committed Dec 5, 2024
1 parent 889b264 commit f775e3d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/hal/drivers/mesa-hostmot2/spix_spidev.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,14 @@ static int port_configure(spidev_port_t *sdp, const spix_args_t *args)
uint8_t b;
uint32_t w;
int e;
uint32_t clkw = args->clkw;
uint32_t clkw = args->clkw; // Requested write and read clocks
uint32_t clkr = args->clkr;
const char *devname = args->spidev ? args->spidev : sdp->spix.name;

if((fd = open(devname, O_RDWR)) < 0) {
// Module argument override of device node path
if(args->spidev)
sdp->spix.name = args->spidev;

if((fd = open(sdp->spix.name, O_RDWR)) < 0) {
LL_ERR("%s: Cannot open port: %s\n", sdp->spix.name, strerror(e = errno));
return -e;
}
Expand Down Expand Up @@ -256,8 +259,7 @@ static int spidev_cleanup(void)
}

/*
* Open a SPI port at index 'port' with 'clkw' write clock and 'clkr' read
* clock frequencies.
* Open a SPI port at index 'port' using 'args' to configure.
*/
static const spix_port_t *spidev_open(int port, const spix_args_t *args)
{
Expand Down

0 comments on commit f775e3d

Please sign in to comment.