Hi Arushi, [auto build test ERROR on staging/staging-testing] [also build test ERROR on v4.10-rc8 next-20170214] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Arushi-Singhal/staging-fwserial-replace-a-with-a-to-avoid-precedence-issues/20170215-020955 config: i386-randconfig-s0-02131304 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=i386 All error/warnings (new ones prefixed by >>): >> drivers/staging/fwserial/fwserial.c:101:19: error: "(" may not appear in macro parameter list #define to_device((a), b) (a->b) ^ In file included from drivers/staging/fwserial/fwserial.c:21:0: drivers/staging/fwserial/fwserial.c: In function 'fwtty_log_tx_error': >> drivers/staging/fwserial/fwserial.c:111:22: error: implicit declaration of function 'to_device' [-Werror=implicit-function-declaration] dev_err_ratelimited(to_device(p, device), fmt, ##__VA_ARGS__) ^ include/linux/device.h:1364:13: note: in definition of macro 'dev_level_ratelimited' dev_level(dev, fmt, ##__VA_ARGS__); \ ^~~ >> drivers/staging/fwserial/fwserial.c:111:2: note: in expansion of macro 'dev_err_ratelimited' dev_err_ratelimited(to_device(p, device), fmt, ##__VA_ARGS__) ^~~~~~~~~~~~~~~~~~~ >> drivers/staging/fwserial/fwserial.c:201:3: note: in expansion of macro 'fwtty_err_ratelimited' fwtty_err_ratelimited(port, "card busy\n"); ^~~~~~~~~~~~~~~~~~~~~ >> drivers/staging/fwserial/fwserial.c:111:35: error: 'device' undeclared (first use in this function) dev_err_ratelimited(to_device(p, device), fmt, ##__VA_ARGS__) ^ include/linux/device.h:1364:13: note: in definition of macro 'dev_level_ratelimited' dev_level(dev, fmt, ##__VA_ARGS__); \ ^~~ >> drivers/staging/fwserial/fwserial.c:111:2: note: in expansion of macro 'dev_err_ratelimited' dev_err_ratelimited(to_device(p, device), fmt, ##__VA_ARGS__) ^~~~~~~~~~~~~~~~~~~ >> drivers/staging/fwserial/fwserial.c:201:3: note: in expansion of macro 'fwtty_err_ratelimited' fwtty_err_ratelimited(port, "card busy\n"); ^~~~~~~~~~~~~~~~~~~~~ drivers/staging/fwserial/fwserial.c:111:35: note: each undeclared identifier is reported only once for each function it appears in dev_err_ratelimited(to_device(p, device), fmt, ##__VA_ARGS__) ^ include/linux/device.h:1364:13: note: in definition of macro 'dev_level_ratelimited' dev_level(dev, fmt, ##__VA_ARGS__); \ ^~~ >> drivers/staging/fwserial/fwserial.c:111:2: note: in expansion of macro 'dev_err_ratelimited' dev_err_ratelimited(to_device(p, device), fmt, ##__VA_ARGS__) ^~~~~~~~~~~~~~~~~~~ >> drivers/staging/fwserial/fwserial.c:201:3: note: in expansion of macro 'fwtty_err_ratelimited' fwtty_err_ratelimited(port, "card busy\n"); ^~~~~~~~~~~~~~~~~~~~~ In file included from include/linux/printk.h:320:0, from include/linux/kernel.h:13, from include/linux/sched.h:17, from drivers/staging/fwserial/fwserial.c:19: drivers/staging/fwserial/fwserial.c: In function '__fwtty_restart_tx': drivers/staging/fwserial/fwserial.c:109:23: error: 'device' undeclared (first use in this function) dev_dbg(to_device(p, device), "%s: " fmt, __func__, ##__VA_ARGS__) ^ include/linux/dynamic_debug.h:134:34: note: in definition of macro 'dynamic_dev_dbg' __dynamic_dev_dbg(&descriptor, dev, fmt, \ ^~~ >> drivers/staging/fwserial/fwserial.c:109:2: note: in expansion of macro 'dev_dbg' dev_dbg(to_device(p, device), "%s: " fmt, __func__, ##__VA_ARGS__) ^~~~~~~ >> drivers/staging/fwserial/fwserial.c:290:2: note: in expansion of macro 'fwtty_dbg' fwtty_dbg(port, "fifo len: %d avail: %d\n", len, avail); ^~~~~~~~~ drivers/staging/fwserial/fwserial.c: In function 'fwtty_update_port_status': drivers/staging/fwserial/fwserial.c:109:23: error: 'device' undeclared (first use in this function) dev_dbg(to_device(p, device), "%s: " fmt, __func__, ##__VA_ARGS__) ^ include/linux/dynamic_debug.h:134:34: note: in definition of macro 'dynamic_dev_dbg' __dynamic_dev_dbg(&descriptor, dev, fmt, \ ^~~ >> drivers/staging/fwserial/fwserial.c:109:2: note: in expansion of macro 'dev_dbg' dev_dbg(to_device(p, device), "%s: " fmt, __func__, ##__VA_ARGS__) ^~~~~~~ drivers/staging/fwserial/fwserial.c:327:2: note: in expansion of macro 'fwtty_dbg' fwtty_dbg(port, "status: %x delta: %x\n", status, delta); ^~~~~~~~~ drivers/staging/fwserial/fwserial.c: In function 'fwtty_emit_breaks': drivers/staging/fwserial/fwserial.c:109:23: error: 'device' undeclared (first use in this function) dev_dbg(to_device(p, device), "%s: " fmt, __func__, ##__VA_ARGS__) ^ include/linux/dynamic_debug.h:134:34: note: in definition of macro 'dynamic_dev_dbg' __dynamic_dev_dbg(&descriptor, dev, fmt, \ ^~~ >> drivers/staging/fwserial/fwserial.c:109:2: note: in expansion of macro 'dev_dbg' dev_dbg(to_device(p, device), "%s: " fmt, __func__, ##__VA_ARGS__) ^~~~~~~ drivers/staging/fwserial/fwserial.c:523:2: note: in expansion of macro 'fwtty_dbg' fwtty_dbg(port, "sending %d brks\n", n); ^~~~~~~~~ drivers/staging/fwserial/fwserial.c: In function 'fwtty_rx': drivers/staging/fwserial/fwserial.c:109:23: error: 'device' undeclared (first use in this function) dev_dbg(to_device(p, device), "%s: " fmt, __func__, ##__VA_ARGS__) ^ include/linux/dynamic_debug.h:134:34: note: in definition of macro 'dynamic_dev_dbg' __dynamic_dev_dbg(&descriptor, dev, fmt, \ ^~~ >> drivers/staging/fwserial/fwserial.c:109:2: note: in expansion of macro 'dev_dbg' dev_dbg(to_device(p, device), "%s: " fmt, __func__, ##__VA_ARGS__) ^~~~~~~ drivers/staging/fwserial/fwserial.c:547:2: note: in expansion of macro 'fwtty_dbg' fwtty_dbg(port, "%d\n", n); ^~~~~~~~~ In file included from drivers/staging/fwserial/fwserial.c:21:0: drivers/staging/fwserial/fwserial.c: In function 'fwtty_port_handler': >> drivers/staging/fwserial/fwserial.c:111:35: error: 'device' undeclared (first use in this function) dev_err_ratelimited(to_device(p, device), fmt, ##__VA_ARGS__) ^ include/linux/device.h:1364:13: note: in definition of macro 'dev_level_ratelimited' dev_level(dev, fmt, ##__VA_ARGS__); \ ^~~ >> drivers/staging/fwserial/fwserial.c:111:2: note: in expansion of macro 'dev_err_ratelimited' dev_err_ratelimited(to_device(p, device), fmt, ##__VA_ARGS__) ^~~~~~~~~~~~~~~~~~~ drivers/staging/fwserial/fwserial.c:630:3: note: in expansion of macro 'fwtty_err_ratelimited' fwtty_err_ratelimited(port, "ignoring unauthenticated data\n"); ^~~~~~~~~~~~~~~~~~~~~ In file included from include/linux/printk.h:320:0, from include/linux/kernel.h:13, from include/linux/sched.h:17, from drivers/staging/fwserial/fwserial.c:19: drivers/staging/fwserial/fwserial.c: In function 'fwtty_tx_complete': drivers/staging/fwserial/fwserial.c:109:23: error: 'device' undeclared (first use in this function) dev_dbg(to_device(p, device), "%s: " fmt, __func__, ##__VA_ARGS__) ^ include/linux/dynamic_debug.h:134:34: note: in definition of macro 'dynamic_dev_dbg' __dynamic_dev_dbg(&descriptor, dev, fmt, \ ^~~ >> drivers/staging/fwserial/fwserial.c:109:2: note: in expansion of macro 'dev_dbg' dev_dbg(to_device(p, device), "%s: " fmt, __func__, ##__VA_ARGS__) ^~~~~~~ drivers/staging/fwserial/fwserial.c:687:2: note: in expansion of macro 'fwtty_dbg' fwtty_dbg(port, "rcode: %d\n", rcode); ^~~~~~~~~ drivers/staging/fwserial/fwserial.c: In function 'fwtty_tx': drivers/staging/fwserial/fwserial.c:109:23: error: 'device' undeclared (first use in this function) dev_dbg(to_device(p, device), "%s: " fmt, __func__, ##__VA_ARGS__) ^ include/linux/dynamic_debug.h:134:34: note: in definition of macro 'dynamic_dev_dbg' __dynamic_dev_dbg(&descriptor, dev, fmt, \ ^~~ >> drivers/staging/fwserial/fwserial.c:109:2: note: in expansion of macro 'dev_dbg' dev_dbg(to_device(p, device), "%s: " fmt, __func__, ##__VA_ARGS__) ^~~~~~~ drivers/staging/fwserial/fwserial.c:750:3: note: in expansion of macro 'fwtty_dbg' fwtty_dbg(port, "out: %u rem: %d\n", txn->dma_pended.len, n); ^~~~~~~~~ drivers/staging/fwserial/fwserial.c: In function 'fwtty_write_xchar': drivers/staging/fwserial/fwserial.c:109:23: error: 'device' undeclared (first use in this function) dev_dbg(to_device(p, device), "%s: " fmt, __func__, ##__VA_ARGS__) ^ include/linux/dynamic_debug.h:134:34: note: in definition of macro 'dynamic_dev_dbg' __dynamic_dev_dbg(&descriptor, dev, fmt, \ ^~~ >> drivers/staging/fwserial/fwserial.c:109:2: note: in expansion of macro 'dev_dbg' dev_dbg(to_device(p, device), "%s: " fmt, __func__, ##__VA_ARGS__) ^~~~~~~ drivers/staging/fwserial/fwserial.c:820:2: note: in expansion of macro 'fwtty_dbg' fwtty_dbg(port, "%02x\n", ch); ^~~~~~~~~ drivers/staging/fwserial/fwserial.c: In function 'fwtty_port_dtr_rts': drivers/staging/fwserial/fwserial.c:109:23: error: 'device' undeclared (first use in this function) dev_dbg(to_device(p, device), "%s: " fmt, __func__, ##__VA_ARGS__) ^ include/linux/dynamic_debug.h:134:34: note: in definition of macro 'dynamic_dev_dbg' __dynamic_dev_dbg(&descriptor, dev, fmt, \ ^~~ >> drivers/staging/fwserial/fwserial.c:109:2: note: in expansion of macro 'dev_dbg' dev_dbg(to_device(p, device), "%s: " fmt, __func__, ##__VA_ARGS__) ^~~~~~~ drivers/staging/fwserial/fwserial.c:905:2: note: in expansion of macro 'fwtty_dbg' fwtty_dbg(port, "on/off: %d\n", on); ^~~~~~~~~ drivers/staging/fwserial/fwserial.c: In function 'fwtty_port_carrier_raised': drivers/staging/fwserial/fwserial.c:109:23: error: 'device' undeclared (first use in this function) dev_dbg(to_device(p, device), "%s: " fmt, __func__, ##__VA_ARGS__) ^ include/linux/dynamic_debug.h:134:34: note: in definition of macro 'dynamic_dev_dbg' __dynamic_dev_dbg(&descriptor, dev, fmt, \ ^~~ vim +101 drivers/staging/fwserial/fwserial.c 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 */ 16 17 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 18 > 19 #include <linux/sched.h> 20 #include <linux/slab.h> > 21 #include <linux/device.h> 22 #include <linux/mod_devicetable.h> 23 #include <linux/rculist.h> 24 #include <linux/workqueue.h> 25 #include <linux/ratelimit.h> 26 #include <linux/bug.h> 27 #include <linux/uaccess.h> 28 29 #include "fwserial.h" 30 31 #define be32_to_u64(hi, lo) ((u64)be32_to_cpu(hi) << 32 | be32_to_cpu(lo)) 32 33 #define LINUX_VENDOR_ID 0xd00d1eU /* same id used in card root directory */ 34 #define FWSERIAL_VERSION 0x00e81cU /* must be unique within LINUX_VENDOR_ID */ 35 36 /* configurable options */ 37 static int num_ttys = 4; /* # of std ttys to create per fw_card */ 38 /* - doubles as loopback port index */ 39 static bool auto_connect = true; /* try to VIRT_CABLE to every peer */ 40 static bool create_loop_dev = true; /* create a loopback device for each card */ 41 42 module_param_named(ttys, num_ttys, int, 0644); 43 module_param_named(auto, auto_connect, bool, 0644); 44 module_param_named(loop, create_loop_dev, bool, 0644); 45 46 /* 47 * Threshold below which the tty is woken for writing 48 * - should be equal to WAKEUP_CHARS in drivers/tty/n_tty.c because 49 * even if the writer is woken, n_tty_poll() won't set POLLOUT until 50 * our fifo is below this level 51 */ 52 #define WAKEUP_CHARS 256 53 54 /** 55 * fwserial_list: list of every fw_serial created for each fw_card 56 * See discussion in fwserial_probe. 57 */ 58 static LIST_HEAD(fwserial_list); 59 static DEFINE_MUTEX(fwserial_list_mutex); 60 61 /** 62 * port_table: array of tty ports allocated to each fw_card 63 * 64 * tty ports are allocated during probe when an fw_serial is first 65 * created for a given fw_card. Ports are allocated in a contiguous block, 66 * each block consisting of 'num_ports' ports. 67 */ 68 static struct fwtty_port *port_table[MAX_TOTAL_PORTS]; 69 static DEFINE_MUTEX(port_table_lock); 70 static bool port_table_corrupt; 71 #define FWTTY_INVALID_INDEX MAX_TOTAL_PORTS 72 73 #define loop_idx(port) (((port)->index) / num_ports) 74 #define table_idx(loop) ((loop) * num_ports + num_ttys) 75 76 /* total # of tty ports created per fw_card */ 77 static int num_ports; 78 79 /* slab used as pool for struct fwtty_transactions */ 80 static struct kmem_cache *fwtty_txn_cache; 81 82 struct tty_driver *fwtty_driver; 83 static struct tty_driver *fwloop_driver; 84 85 static struct dentry *fwserial_debugfs; 86 87 struct fwtty_transaction; 88 typedef void (*fwtty_transaction_cb)(struct fw_card *card, int rcode, 89 void *data, size_t length, 90 struct fwtty_transaction *txn); 91 92 struct fwtty_transaction { 93 struct fw_transaction fw_txn; 94 fwtty_transaction_cb callback; 95 struct fwtty_port *port; 96 union { 97 struct dma_pending dma_pended; 98 }; 99 }; 100 > 101 #define to_device((a), b) (a->b) 102 #define fwtty_err(p, fmt, ...) \ 103 dev_err(to_device(p, device), fmt, ##__VA_ARGS__) 104 #define fwtty_info(p, fmt, ...) \ 105 dev_info(to_device(p, device), fmt, ##__VA_ARGS__) 106 #define fwtty_notice(p, fmt, ...) \ 107 dev_notice(to_device(p, device), fmt, ##__VA_ARGS__) 108 #define fwtty_dbg(p, fmt, ...) \ > 109 dev_dbg(to_device(p, device), "%s: " fmt, __func__, ##__VA_ARGS__) 110 #define fwtty_err_ratelimited(p, fmt, ...) \ > 111 dev_err_ratelimited(to_device(p, device), fmt, ##__VA_ARGS__) 112 113 #ifdef DEBUG 114 static inline void debug_short_write(struct fwtty_port *port, int c, int n) 115 { 116 int avail; 117 118 if (n < c) { 119 spin_lock_bh(&port->lock); 120 avail = dma_fifo_avail(&port->tx_fifo); 121 spin_unlock_bh(&port->lock); 122 fwtty_dbg(port, "short write: avail:%d req:%d wrote:%d\n", 123 avail, c, n); 124 } 125 } 126 #else 127 #define debug_short_write(port, c, n) 128 #endif 129 130 static struct fwtty_peer *__fwserial_peer_by_node_id(struct fw_card *card, 131 int generation, int id); 132 133 #ifdef FWTTY_PROFILING 134 135 static void fwtty_profile_fifo(struct fwtty_port *port, unsigned int *stat) 136 { 137 spin_lock_bh(&port->lock); 138 fwtty_profile_data(stat, dma_fifo_avail(&port->tx_fifo)); 139 spin_unlock_bh(&port->lock); 140 } 141 142 static void fwtty_dump_profile(struct seq_file *m, struct stats *stats) 143 { 144 /* for each stat, print sum of 0 to 2^k, then individually */ 145 int k = 4; 146 unsigned int sum; 147 int j; 148 char t[10]; 149 150 snprintf(t, 10, "< %d", 1 << k); 151 seq_printf(m, "\n%14s %6s", " ", t); 152 for (j = k + 1; j < DISTRIBUTION_MAX_INDEX; ++j) 153 seq_printf(m, "%6d", 1 << j); 154 155 ++k; 156 for (j = 0, sum = 0; j <= k; ++j) 157 sum += stats->reads[j]; 158 seq_printf(m, "\n%14s: %6d", "reads", sum); 159 for (j = k + 1; j <= DISTRIBUTION_MAX_INDEX; ++j) 160 seq_printf(m, "%6d", stats->reads[j]); 161 162 for (j = 0, sum = 0; j <= k; ++j) 163 sum += stats->writes[j]; 164 seq_printf(m, "\n%14s: %6d", "writes", sum); 165 for (j = k + 1; j <= DISTRIBUTION_MAX_INDEX; ++j) 166 seq_printf(m, "%6d", stats->writes[j]); 167 168 for (j = 0, sum = 0; j <= k; ++j) 169 sum += stats->txns[j]; 170 seq_printf(m, "\n%14s: %6d", "txns", sum); 171 for (j = k + 1; j <= DISTRIBUTION_MAX_INDEX; ++j) 172 seq_printf(m, "%6d", stats->txns[j]); 173 174 for (j = 0, sum = 0; j <= k; ++j) 175 sum += stats->unthrottle[j]; 176 seq_printf(m, "\n%14s: %6d", "avail @ unthr", sum); 177 for (j = k + 1; j <= DISTRIBUTION_MAX_INDEX; ++j) 178 seq_printf(m, "%6d", stats->unthrottle[j]); 179 } 180 181 #else 182 #define fwtty_profile_fifo(port, stat) 183 #define fwtty_dump_profile(m, stats) 184 #endif 185 186 /* 187 * Returns the max receive packet size for the given node 188 * Devices which are OHCI v1.0/ v1.1/ v1.2-draft or RFC 2734 compliant 189 * are required by specification to support max_rec of 8 (512 bytes) or more. 190 */ 191 static inline int device_max_receive(struct fw_device *fw_device) 192 { 193 /* see IEEE 1394-2008 table 8-8 */ 194 return min(2 << fw_device->max_rec, 4096); 195 } 196 197 static void fwtty_log_tx_error(struct fwtty_port *port, int rcode) 198 { 199 switch (rcode) { 200 case RCODE_SEND_ERROR: > 201 fwtty_err_ratelimited(port, "card busy\n"); 202 break; 203 case RCODE_ADDRESS_ERROR: 204 fwtty_err_ratelimited(port, "bad unit addr or write length\n"); 205 break; 206 case RCODE_DATA_ERROR: 207 fwtty_err_ratelimited(port, "failed rx\n"); 208 break; 209 case RCODE_NO_ACK: 210 fwtty_err_ratelimited(port, "missing ack\n"); 211 break; 212 case RCODE_BUSY: 213 fwtty_err_ratelimited(port, "remote busy\n"); 214 break; 215 default: 216 fwtty_err_ratelimited(port, "failed tx: %d\n", rcode); 217 } 218 } 219 220 static void fwtty_txn_constructor(void *this) 221 { 222 struct fwtty_transaction *txn = this; 223 224 init_timer(&txn->fw_txn.split_timeout_timer); 225 } 226 227 static void fwtty_common_callback(struct fw_card *card, int rcode, 228 void *payload, size_t len, void *cb_data) 229 { 230 struct fwtty_transaction *txn = cb_data; 231 struct fwtty_port *port = txn->port; 232 233 if (port && rcode != RCODE_COMPLETE) 234 fwtty_log_tx_error(port, rcode); 235 if (txn->callback) 236 txn->callback(card, rcode, payload, len, txn); 237 kmem_cache_free(fwtty_txn_cache, txn); 238 } 239 240 static int fwtty_send_data_async(struct fwtty_peer *peer, int tcode, 241 unsigned long long addr, void *payload, 242 size_t len, fwtty_transaction_cb callback, 243 struct fwtty_port *port) 244 { 245 struct fwtty_transaction *txn; 246 int generation; 247 248 txn = kmem_cache_alloc(fwtty_txn_cache, GFP_ATOMIC); 249 if (!txn) 250 return -ENOMEM; 251 252 txn->callback = callback; 253 txn->port = port; 254 255 generation = peer->generation; 256 smp_rmb(); 257 fw_send_request(peer->serial->card, &txn->fw_txn, tcode, 258 peer->node_id, generation, peer->speed, addr, payload, 259 len, fwtty_common_callback, txn); 260 return 0; 261 } 262 263 static void fwtty_send_txn_async(struct fwtty_peer *peer, 264 struct fwtty_transaction *txn, int tcode, 265 unsigned long long addr, void *payload, 266 size_t len, fwtty_transaction_cb callback, 267 struct fwtty_port *port) 268 { 269 int generation; 270 271 txn->callback = callback; 272 txn->port = port; 273 274 generation = peer->generation; 275 smp_rmb(); 276 fw_send_request(peer->serial->card, &txn->fw_txn, tcode, 277 peer->node_id, generation, peer->speed, addr, payload, 278 len, fwtty_common_callback, txn); 279 } 280 281 static void __fwtty_restart_tx(struct fwtty_port *port) 282 { 283 int len, avail; 284 285 len = dma_fifo_out_level(&port->tx_fifo); 286 if (len) 287 schedule_delayed_work(&port->drain, 0); 288 avail = dma_fifo_avail(&port->tx_fifo); 289 > 290 fwtty_dbg(port, "fifo len: %d avail: %d\n", len, avail); 291 } 292 293 static void fwtty_restart_tx(struct fwtty_port *port) --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip
_______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel