Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751978AbaASTfE (ORCPT ); Sun, 19 Jan 2014 14:35:04 -0500 Received: from smtprelay0125.hostedemail.com ([216.40.44.125]:45557 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751727AbaASTfB (ORCPT ); Sun, 19 Jan 2014 14:35:01 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:960:973:988:989:1260:1261:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1535:1544:1593:1594:1605:1711:1730:1747:1777:1792:2194:2199:2393:2553:2559:2562:2828:2890:3138:3139:3140:3141:3142:3622:3865:3866:3867:3868:3872:3873:3874:4042:4250:4321:5007:7652:7903:7904:9038:10004:10848:11026:11232:11473:11658:119 X-HE-Tag: desk92_e0b107eab456 X-Filterd-Recvd-Size: 5633 Message-ID: <1390160095.2290.9.camel@joe-AO722> Subject: Re: ping [PATCH v3] WAN: Adding support for Lantiq PEF2256 E1 chipset (FALC56) From: Joe Perches To: Christophe Leroy Cc: Rob Herring , Pawel Moll , Mark Rutland , Stephen Warren , Ian Campbell , Rob Landley , Grant Likely , Krzysztof Halasa , devicetree@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, marc.balemboy@c-s.fr Date: Sun, 19 Jan 2014 11:34:55 -0800 In-Reply-To: <20140119180732.A1D99432AF@localhost.localdomain> References: <20140119180732.A1D99432AF@localhost.localdomain> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.8.4-0ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2014-01-19 at 19:07 +0100, Christophe Leroy wrote: > Pinging this watch as we got no feedback since 22 Nov, although we have taken > into account reviews from v1 and v2. > > The patch adds WAN support for Lantiq FALC56 - PEF2256 E1 Chipset. trivia: > diff -urN a/drivers/net/wan/pef2256.c b/drivers/net/wan/pef2256.c [] > +static void config_hdlc_timeslot(struct pef2256_dev_priv *priv, int ts) > +{ > + static struct { > + u32 ttr; > + u32 rtr; > + } regs[] = { > + { TTR1, RTR1 }, > + { TTR2, RTR2 }, > + { TTR3, RTR3 }, > + { TTR4, RTR4 }, > + }; const > + int cfg_bit = 1 << (31 - ts); > + int reg_bit = 1 << (7 - (ts % 8)); > + int j = ts / 8; looks endian specific > + > + if (j >= 4) > + return; > + > + if (priv->Tx_TS & cfg_bit) > + pef2256_s8(priv, regs[j].ttr, 1 << reg_bit); > + > + if (priv->Rx_TS & cfg_bit) > + pef2256_s8(priv, regs[j].rtr, 1 << reg_bit); > +} > +static void init_falc(struct pef2256_dev_priv *priv) > +{ a lot of the below looks like it should use switch/case blocks. > + /* Clocking rate for FALC56 */ > + > + /* Nothing to do for clocking rate 2M */ > + > + /* clocking rate 4M */ > + if (priv->clock_rate == CLOCK_RATE_4M) > + pef2256_s8(priv, SIC1, SIC1_SSC0); > + > + /* clocking rate 8M */ > + if (priv->clock_rate == CLOCK_RATE_8M) > + pef2256_s8(priv, SIC1, SIC1_SSC1); > + > + /* clocking rate 16M */ > + if (priv->clock_rate == CLOCK_RATE_16M) { > + pef2256_s8(priv, SIC1, SIC1_SSC0); > + pef2256_s8(priv, SIC1, SIC1_SSC1); > + } > + > + /* data rate for FALC56 */ > + > + /* Nothing to do for data rate 2M on the system data bus */ > + > + /* data rate 4M on the system data bus */ > + if (priv->data_rate == DATA_RATE_4M) > + pef2256_s8(priv, FMR1, FMR1_SSD0); > + > + /* data rate 8M on the system data bus */ > + if (priv->data_rate == DATA_RATE_8M) > + pef2256_s8(priv, SIC1, SIC1_SSD1); > + > + /* data rate 16M on the system data bus */ > + if (priv->data_rate == DATA_RATE_16M) { > + pef2256_s8(priv, FMR1, FMR1_SSD0); > + pef2256_s8(priv, SIC1, SIC1_SSD1); > + } > + > + /* channel phase for FALC56 */ > + > + /* Nothing to do for channel phase 1 */ > + > + if (priv->channel_phase == CHANNEL_PHASE_2) > + pef2256_s8(priv, SIC2, SIC2_SICS0); > + > + if (priv->channel_phase == CHANNEL_PHASE_3) > + pef2256_s8(priv, SIC2, SIC2_SICS1); > + > + if (priv->channel_phase == CHANNEL_PHASE_4) { > + pef2256_s8(priv, SIC2, SIC2_SICS0); > + pef2256_s8(priv, SIC2, SIC2_SICS1); > + } > + > + if (priv->channel_phase == CHANNEL_PHASE_5) > + pef2256_s8(priv, SIC2, SIC2_SICS2); > + > + if (priv->channel_phase == CHANNEL_PHASE_6) { > + pef2256_s8(priv, SIC2, SIC2_SICS0); > + pef2256_s8(priv, SIC2, SIC2_SICS2); > + } > + > + if (priv->channel_phase == CHANNEL_PHASE_7) { > + pef2256_s8(priv, SIC2, SIC2_SICS1); > + pef2256_s8(priv, SIC2, SIC2_SICS2); > + } > + > + if (priv->channel_phase == CHANNEL_PHASE_8) { > + pef2256_s8(priv, SIC2, SIC2_SICS0); > + pef2256_s8(priv, SIC2, SIC2_SICS1); > + pef2256_s8(priv, SIC2, SIC2_SICS2); > + } > +static ssize_t fs_attr_mode_store(struct device *dev, > + struct device_attribute *attr, const char *buf, > + size_t count) > +{ > + struct net_device *ndev = dev_get_drvdata(dev); > + struct pef2256_dev_priv *priv = dev_to_hdlc(ndev)->priv; > + long int value; > + int ret = kstrtol(buf, 10, &value); > + int reconfigure = (value != priv->mode); Ugly test and set before determining if the previous function was successful. > + if (value != MASTER_MODE && value != SLAVE_MODE) > + ret = -EINVAL; > + > + if (ret < 0) > + netdev_info(ndev, "Invalid mode (0 or 1 expected\n"); > + else { > + priv->mode = value; > + if (reconfigure && netif_carrier_ok(ndev)) > + init_falc(priv); > + } > + > + return strnlen(buf, count); odd that you set ret and then don't use it. > +static ssize_t fs_attr_Tx_TS_store(struct device *dev, > + struct device_attribute *attr, const char *buf, > + size_t count) > +{ > + struct net_device *ndev = dev_get_drvdata(dev); > + struct pef2256_dev_priv *priv = dev_to_hdlc(ndev)->priv; > + unsigned long value; > + int ret = kstrtoul(buf, 16, (long int *)&value); unportable cast > + int reconfigure = (value != priv->mode); again with the test/set before determining function success. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/