lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yc3sLEjF6O1CaMZZ@lunn.ch>
Date:   Thu, 30 Dec 2021 18:28:12 +0100
From:   Andrew Lunn <andrew@...n.ch>
To:     Dimitris Michailidis <d.michailidis@...gible.com>
Cc:     davem@...emloft.net, kuba@...nel.org, netdev@...r.kernel.org
Subject: Re: [PATCH net-next 2/8] net/fungible: Add service module for
 Fungible drivers

> +/* Wait for the CSTS.RDY bit to match @enabled. */
> +static int fun_wait_ready(struct fun_dev *fdev, bool enabled)
> +{
> +	unsigned int cap_to = NVME_CAP_TIMEOUT(fdev->cap_reg);
> +	unsigned long timeout = ((cap_to + 1) * HZ / 2) + jiffies;
> +	u32 bit = enabled ? NVME_CSTS_RDY : 0;

Reverse Christmas tree, since this is a network driver.

Please also consider using include/linux/iopoll.h. The signal handling
might make that not possible, but signal handling in driver code is in
itself very unusual.

> +
> +	do {
> +		u32 csts = readl(fdev->bar + NVME_REG_CSTS);
> +
> +		if (csts == ~0) {
> +			dev_err(fdev->dev, "CSTS register read %#x\n", csts);
> +			return -EIO;
> +		}
> +
> +		if ((csts & NVME_CSTS_RDY) == bit)
> +			return 0;
> +
> +		msleep(100);
> +		if (fatal_signal_pending(current))
> +			return -EINTR;
> +	} while (time_is_after_eq_jiffies(timeout));
> +
> +	dev_err(fdev->dev,
> +		"Timed out waiting for device to indicate RDY %u; aborting %s\n",
> +		enabled, enabled ? "initialization" : "reset");
> +	return -ETIMEDOUT;
> +}

  Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ