/* Returns alignment on success, 0 (invalid alignment) on failure.  */
resource_size_t resource_alignment(struct resource *res)
/* Returns alignment on success, 0 (invalid alignment) on failure.  */
resource_size_t resource_alignment(struct resource *res)
{
	switch (res->flags & (IORESOURCE_SIZEALIGN | IORESOURCE_STARTALIGN)) {
	case IORESOURCE_SIZEALIGN:
		return resource_size(res);
	case IORESOURCE_STARTALIGN:
		return res->start;
	default:
		return 0;
	}
}