|
8 | 8 | * The serial core bus manages the serial core controller instances. |
9 | 9 | */ |
10 | 10 |
|
11 | | -#include <linux/cleanup.h> |
12 | 11 | #include <linux/container_of.h> |
13 | 12 | #include <linux/device.h> |
14 | 13 | #include <linux/idr.h> |
@@ -205,134 +204,6 @@ void serial_base_port_device_remove(struct serial_port_device *port_dev) |
205 | 204 | put_device(&port_dev->dev); |
206 | 205 | } |
207 | 206 |
|
208 | | -#ifdef CONFIG_SERIAL_CORE_CONSOLE |
209 | | - |
210 | | -static int serial_base_add_one_prefcon(const char *match, const char *dev_name, |
211 | | - int port_id) |
212 | | -{ |
213 | | - int ret; |
214 | | - |
215 | | - ret = add_preferred_console_match(match, dev_name, port_id); |
216 | | - if (ret == -ENOENT) |
217 | | - return 0; |
218 | | - |
219 | | - return ret; |
220 | | -} |
221 | | - |
222 | | -#ifdef __sparc__ |
223 | | - |
224 | | -/* Handle Sparc ttya and ttyb options as done in console_setup() */ |
225 | | -static int serial_base_add_sparc_console(const char *dev_name, int idx) |
226 | | -{ |
227 | | - const char *name; |
228 | | - |
229 | | - switch (idx) { |
230 | | - case 0: |
231 | | - name = "ttya"; |
232 | | - break; |
233 | | - case 1: |
234 | | - name = "ttyb"; |
235 | | - break; |
236 | | - default: |
237 | | - return 0; |
238 | | - } |
239 | | - |
240 | | - return serial_base_add_one_prefcon(name, dev_name, idx); |
241 | | -} |
242 | | - |
243 | | -#else |
244 | | - |
245 | | -static inline int serial_base_add_sparc_console(const char *dev_name, int idx) |
246 | | -{ |
247 | | - return 0; |
248 | | -} |
249 | | - |
250 | | -#endif |
251 | | - |
252 | | -static int serial_base_add_prefcon(const char *name, int idx) |
253 | | -{ |
254 | | - const char *char_match __free(kfree) = NULL; |
255 | | - const char *nmbr_match __free(kfree) = NULL; |
256 | | - int ret; |
257 | | - |
258 | | - /* Handle ttyS specific options */ |
259 | | - if (strstarts(name, "ttyS")) { |
260 | | - /* No name, just a number */ |
261 | | - nmbr_match = kasprintf(GFP_KERNEL, "%i", idx); |
262 | | - if (!nmbr_match) |
263 | | - return -ENODEV; |
264 | | - |
265 | | - ret = serial_base_add_one_prefcon(nmbr_match, name, idx); |
266 | | - if (ret) |
267 | | - return ret; |
268 | | - |
269 | | - /* Sparc ttya and ttyb */ |
270 | | - ret = serial_base_add_sparc_console(name, idx); |
271 | | - if (ret) |
272 | | - return ret; |
273 | | - } |
274 | | - |
275 | | - /* Handle the traditional character device name style console=ttyS0 */ |
276 | | - char_match = kasprintf(GFP_KERNEL, "%s%i", name, idx); |
277 | | - if (!char_match) |
278 | | - return -ENOMEM; |
279 | | - |
280 | | - return serial_base_add_one_prefcon(char_match, name, idx); |
281 | | -} |
282 | | - |
283 | | -/** |
284 | | - * serial_base_add_preferred_console - Adds a preferred console |
285 | | - * @drv: Serial port device driver |
286 | | - * @port: Serial port instance |
287 | | - * |
288 | | - * Tries to add a preferred console for a serial port if specified in the |
289 | | - * kernel command line. Supports both the traditional character device such |
290 | | - * as console=ttyS0, and a hardware addressing based console=DEVNAME:0.0 |
291 | | - * style name. |
292 | | - * |
293 | | - * Translates the kernel command line option using a hardware based addressing |
294 | | - * console=DEVNAME:0.0 to the serial port character device such as ttyS0. |
295 | | - * Cannot be called early for ISA ports, depends on struct device. |
296 | | - * |
297 | | - * Note that duplicates are ignored by add_preferred_console(). |
298 | | - * |
299 | | - * Return: 0 on success, negative error code on failure. |
300 | | - */ |
301 | | -int serial_base_add_preferred_console(struct uart_driver *drv, |
302 | | - struct uart_port *port) |
303 | | -{ |
304 | | - const char *port_match __free(kfree) = NULL; |
305 | | - int ret; |
306 | | - |
307 | | - ret = serial_base_add_prefcon(drv->dev_name, port->line); |
308 | | - if (ret) |
309 | | - return ret; |
310 | | - |
311 | | - port_match = kasprintf(GFP_KERNEL, "%s:%i.%i", dev_name(port->dev), |
312 | | - port->ctrl_id, port->port_id); |
313 | | - if (!port_match) |
314 | | - return -ENOMEM; |
315 | | - |
316 | | - /* Translate a hardware addressing style console=DEVNAME:0.0 */ |
317 | | - return serial_base_add_one_prefcon(port_match, drv->dev_name, port->line); |
318 | | -} |
319 | | - |
320 | | -#endif |
321 | | - |
322 | | -#ifdef CONFIG_SERIAL_8250_CONSOLE |
323 | | - |
324 | | -/* |
325 | | - * Early ISA ports initialize the console before there is no struct device. |
326 | | - * This should be only called from serial8250_isa_init_preferred_console(), |
327 | | - * other callers are likely wrong and should rely on earlycon instead. |
328 | | - */ |
329 | | -int serial_base_add_isa_preferred_console(const char *name, int idx) |
330 | | -{ |
331 | | - return serial_base_add_prefcon(name, idx); |
332 | | -} |
333 | | - |
334 | | -#endif |
335 | | - |
336 | 207 | static int serial_base_init(void) |
337 | 208 | { |
338 | 209 | int ret; |
|
0 commit comments