Re: [PATCH 03/29] drm/i915: Replace the aux ddc name switch statement with a table

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

 



On Thu, Nov 05, 2015 at 04:22:09PM +0200, Ville Syrjälä wrote:
> On Thu, Nov 05, 2015 at 02:10:15PM +0000, Chris Wilson wrote:
> > static const char *ddc_name(enum port port) {
> > 	static const char * const names[] = {
> > 		[PORT_A] = "DPDDC-A",
> > 		[PORT_B] = "DPDDC-B",
> > 		[PORT_C] = "DPDDC-C",
> > 		[PORT_D] = "DPDDC-D",
> > 		[PORT_E] = "DPDDC-E",
> > 	};
> > 	if (WARN_ON(port >= ARRAY_SIZE(names))
> > 		return "DPDDC-XXX";
> > 	return names[port];
> > }
> 
> We can do that. Or we could just do
> kasprintf(GFP_KERNEL, "DPDDC-%c", port_name(port));
> 
> + error handling and kfree() along drm_dp_aux_unregister()
> of course.

Aye, that's better.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux