All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: JosephCHANG <josright123@gmail.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	joseph_chang@davicom.com.tw, netdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3, 2/2] net: Add dm9051 driver
Date: Sun, 12 Dec 2021 03:23:39 +0100	[thread overview]
Message-ID: <YbVdK69SB0Ebt8C9@lunn.ch> (raw)
In-Reply-To: <20211210084021.13993-3-josright123@gmail.com>

> +/* netdev_ops
> + */
> +static int dm9051_open(struct net_device *dev);
> +static int dm9051_stop(struct net_device *dev);
> +static netdev_tx_t dm9051_start_xmit(struct sk_buff *skb, struct net_device *dev);
> +static void dm9051_set_multicast_list_schedule(struct net_device *dev);
> +static int dm9051_set_mac_address(struct net_device *dev, void *p);

You should not need these. Move the code around so the functions come
before there first use.

> +/* carrier
> + */
> +#define	dm_carrier_init(db)			mii_check_link(&(db)->mii)
> +#define	dm_carrier_poll(db)			mii_check_link(&(db)->mii)

I requested you make use of phylib. Once you do, these will go away.

> +#define	dm_carrier_off(dev)			netif_carrier_off(dev)

No wrappers around standard functions. Also, once you use phylib, it
will take care of the carrier for you.

> +
> +/* xmit support
> + */
> +#define	dm_sk_buff_head_init(db)		skb_queue_head_init(&(db)->txq)
> +#define	dm_sk_buff_get(db)			skb_dequeue(&(db)->txq)
> +#define	dm_sk_buff_set(db, skb)			skb_queue_tail(&(db)->txq, skb)

These wrappers should also be removed.

> +/* spi transfers
> + */
> +#define ior					std_spi_read_reg			// read reg
> +#define iior					disp_spi_read_reg			// read disp
> +#define iow					std_spi_write_reg			// write reg
> +#define dm9inblk				std_read_rx_buf_ncpy			// read buff
> +#define dm9outblk				std_write_tx_buf			// write buf
> +
> +#define	ncr_reg_reset(db)			iow(db, DM9051_NCR, NCR_RST)		// reset
> +#define	mbd_reg_byte(db)			iow(db, DM9051_MBNDRY, MBNDRY_BYTE)	// MemBound
> +#define	fcr_reg_enable(db)			iow(db, DM9051_FCR, FCR_FLOW_ENABLE)	// FlowCtrl
> +#define	ppcr_reg_seeting(db)			iow(db, DM9051_PPCR, PPCR_PAUSE_COUNT)	// PauPktCn
> +#define	isr_reg_clear_to_stop_mrcmd(db)		iow(db, DM9051_ISR, 0xff)		// ClearISR
> +#define rcr_reg_stop(db)			iow(db, DM9051_RCR, RCR_RX_DISABLE)	// DisabRX
> +#define imr_reg_stop(db)			iow(db, DM9051_IMR, IMR_PAR)		// DisabAll
> +#define rcr_reg_start(db, rcr_all)		iow(db, DM9051_RCR, rcr_all)		// EnabRX
> +#define imr_reg_start(db, imr_all)		iow(db, DM9051_IMR, imr_all)		// Re-enab
> +#define	intcr_reg_setval(db)			iow(db, DM9051_INTCR, INTCR_POL_LOW)	// INTCR
> +#define	ledcr_reg_setting(db, lcr_all)		iow(db, DM9051_LMCR, lcr_all)		// LEDMode1

Please remove all these wrapper.

       Andrew

      parent reply	other threads:[~2021-12-12  2:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-10  8:40 [PATCH v3, 0/2] ADD DM9051 ETHERNET DRIVER JosephCHANG
2021-12-10  8:40 ` [PATCH v3, 1/2] yaml: Add dm9051 SPI network yaml file JosephCHANG
2021-12-10 14:02   ` Rob Herring
2021-12-10 16:06   ` Rob Herring
2021-12-10  8:40 ` [PATCH v3, 2/2] net: Add dm9051 driver JosephCHANG
2021-12-10 15:01   ` Jakub Kicinski
2021-12-12  2:23   ` Andrew Lunn [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YbVdK69SB0Ebt8C9@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=joseph_chang@davicom.com.tw \
    --cc=josright123@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.