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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 11 Jan 2007 09:33:16 +0000
From:	Christoph Hellwig <hch@...radead.org>
To:	Jay Cliburn <jacliburn@...lsouth.net>
Cc:	jeff@...zik.org, shemminger@...l.org, csnook@...hat.com,
	netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
	atl1-devel@...ts.sourceforge.net
Subject: Re: [PATCH 3/4] atl1: Main C file for Attansic L1 driver

> +#include <asm/page.h>

Why do you need this one?

> +#include <asm/system.h>

Shouldn't be needed aswell.

> +#include <asm/checksum.h>

<net/checksum.h>, please.

> +	spin_lock_init(&adapter->stats_lock);
> +	spin_lock_init(&adapter->tx_lock);
> +	spin_lock_init(&adapter->mb_lock);
> +	spin_lock_init(&adapter->vl_lock);
> +	spin_lock_init(&adapter->mii_lock);

Do you really need that many locks?

> +static inline void atl1_irq_enable(struct atl1_adapter *adapter)
> +{
> +	if (likely(0 == atomic_dec_and_test(&adapter->irq_sem)))
> +		atl1_write32(&adapter->hw, REG_IMR, IMR_NORMAL_MASK);
> +}

We normally prefer atomic_dec_and_test(&adapter->irq_sem) == 0 or
just !atomic_dec_and_test(&adapter->irq_sem).

Also all these little helpers should probably not be marked inline
so gcc can decide on it's own merit which static function to inline.

> +static int atl1_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
> +{
> +	switch (cmd) {
> +	case SIOCGMIIPHY:
> +	case SIOCGMIIREG:
> +	case SIOCSMIIREG:
> +		return atl1_mii_ioctl(netdev, ifr, cmd);
> +	case SIOCETHTOOL:
> +		atl1_set_ethtool_ops(netdev);

ethtool doesn't use the ioctl path anymore at all.

> +static int atl1_open(struct net_device *netdev)
> +{
> +	struct atl1_adapter *adapter = netdev_priv(netdev);
> +	int err;
> +
> +	/* allocate transmit descriptors */
> +	if ((err = atl1_setup_ring_resources(adapter)))
> +		return err;
> +	if ((err = atl1_up(adapter)))
> +		goto err_up;

Preffered style for this is:

	err = atl1_setup_ring_resources(adapter);
	if (err)
		return err;
	err = atl1_up(adapter);
	if (err)
		goto err_up;

(also applies in various other places)

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists