---
name: "spi_bus_lock"
section: "9"
platform: "linux"
package: "linux-manual-3.16"
version: "3.16.56-1+deb8u1"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/spi_bus_lock"
---

# spi\_bus\_lock(9)

obtain a lock for exclusive SPI bus usage

## NAME

spi\_bus\_lock - obtain a lock for exclusive SPI bus usage

## SYNOPSIS

**int spi\_bus\_lock(struct spi\_master \*** *master***);**

## ARGUMENTS

*master*

SPI bus master that should be locked for exclusive bus access

## CONTEXT

can sleep

## DESCRIPTION

This call may only be used from a context that may sleep. The sleep is non-interruptible, and has no timeout.

This call should be used by drivers that require exclusive access to the SPI bus. The SPI bus must be released by a spi\_bus\_unlock call when the exclusive access is over. Data transfer must be done by spi\_sync\_locked and spi\_async\_locked calls when the SPI bus lock is held.

It returns zero on success, else a negative error code.

## COPYRIGHT
