Re: [PATCH 3/4] atl1: Main C file for Attansic L1 driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> +#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 linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux