---
name: "ata_host_alloc"
section: "9"
platform: "linux"
package: "linux-manual-4.9"
version: "4.9.228-1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/ata_host_alloc"
---

# ata\_host\_alloc(9)

allocate and init basic ATA host resources

## NAME

ata\_host\_alloc - allocate and init basic ATA host resources

## SYNOPSIS

**struct ata\_host \* ata\_host\_alloc(struct device \*** *dev***, int** *max\_ports***);**

## ARGUMENTS

*dev*

generic device this host is associated with

*max\_ports*

maximum number of ATA ports associated with this host

## DESCRIPTION

Allocate and initialize basic ATA host resources. LLD calls this function to allocate a host, initializes it fully and attaches it using **ata\_host\_register**.

*max\_ports* ports are allocated and host-\>n\_ports is initialized to *max\_ports*. The caller is allowed to decrease host-\>n\_ports before calling **ata\_host\_register**. The unused ports will be automatically freed on registration.

## RETURN

Allocate ATA host on success, NULL on failure.

LOCKING: Inherited from calling layer (may sleep).

## AUTHOR

**Jeff Garzik**

Author.

## COPYRIGHT
